@jorgmoritz/gis-manager 0.1.39 → 0.1.40
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.cjs +28 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +28 -70
- package/dist/index.js.map +1 -1
- package/dist/vue/index.cjs +25 -68
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +25 -68
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/vue/index.cjs
CHANGED
|
@@ -1509,6 +1509,11 @@ var HeightMarker = class {
|
|
|
1509
1509
|
}
|
|
1510
1510
|
};
|
|
1511
1511
|
|
|
1512
|
+
// src/core/path-manager/constants.ts
|
|
1513
|
+
var DEFAULT_FOV = 172;
|
|
1514
|
+
var SENSOR_WIDTH = 36;
|
|
1515
|
+
var FOCAL_LENGTH_PRESETS = [112, 56, 14, 7, 3, 1];
|
|
1516
|
+
|
|
1512
1517
|
// src/core/path-manager/CameraFOVController.ts
|
|
1513
1518
|
var CameraFOVController = class {
|
|
1514
1519
|
constructor(opts = {}) {
|
|
@@ -1540,8 +1545,8 @@ var CameraFOVController = class {
|
|
|
1540
1545
|
this.updateDisplay();
|
|
1541
1546
|
this.emitChange();
|
|
1542
1547
|
});
|
|
1543
|
-
this.sensorWidth = opts.sensorWidth ??
|
|
1544
|
-
this.focalLengthPresets = opts.focalLengthPresets ??
|
|
1548
|
+
this.sensorWidth = opts.sensorWidth ?? SENSOR_WIDTH;
|
|
1549
|
+
this.focalLengthPresets = opts.focalLengthPresets ?? FOCAL_LENGTH_PRESETS;
|
|
1545
1550
|
if (opts.minFOV === void 0 || opts.maxFOV === void 0) {
|
|
1546
1551
|
const minFocalLength = Math.min(...this.focalLengthPresets);
|
|
1547
1552
|
const maxFocalLength = Math.max(...this.focalLengthPresets);
|
|
@@ -1551,7 +1556,7 @@ var CameraFOVController = class {
|
|
|
1551
1556
|
this.minFOV = opts.minFOV;
|
|
1552
1557
|
this.maxFOV = opts.maxFOV;
|
|
1553
1558
|
}
|
|
1554
|
-
this.currentFOV = opts.initialFOV ??
|
|
1559
|
+
this.currentFOV = opts.initialFOV ?? DEFAULT_FOV;
|
|
1555
1560
|
this.useGlobalEventBus = opts.useGlobalEventBus ?? true;
|
|
1556
1561
|
this.createUI();
|
|
1557
1562
|
this.setupExternalFOVListener();
|
|
@@ -1910,8 +1915,6 @@ var PathPreview = class {
|
|
|
1910
1915
|
// Lightweight overlay viewer
|
|
1911
1916
|
__publicField(this, "containerEl");
|
|
1912
1917
|
// Container for the overlay viewer
|
|
1913
|
-
__publicField(this, "footprintEntity");
|
|
1914
|
-
// Entity for ground footprint polygon
|
|
1915
1918
|
__publicField(this, "destroyed", false);
|
|
1916
1919
|
// Track if the instance has been destroyed
|
|
1917
1920
|
__publicField(this, "fovController");
|
|
@@ -1923,7 +1926,7 @@ var PathPreview = class {
|
|
|
1923
1926
|
__publicField(this, "toggleBtn");
|
|
1924
1927
|
/** 已加载的 3D Tiles 实例(预览窗口独立的) */
|
|
1925
1928
|
__publicField(this, "tilesets", /* @__PURE__ */ new Map());
|
|
1926
|
-
this.currentFOV = opts.fov ??
|
|
1929
|
+
this.currentFOV = opts.fov ?? DEFAULT_FOV;
|
|
1927
1930
|
this.ensureViewer();
|
|
1928
1931
|
this.ensureFOVController();
|
|
1929
1932
|
}
|
|
@@ -2388,28 +2391,6 @@ var PathPreview = class {
|
|
|
2388
2391
|
console.warn("[PathPreview] Failed to update FOV:", e);
|
|
2389
2392
|
}
|
|
2390
2393
|
}
|
|
2391
|
-
// private ensureFootprint(): void {
|
|
2392
|
-
// const C: any = this.CesiumNS as any;
|
|
2393
|
-
// if (this.footprintEntity) return;
|
|
2394
|
-
// this.footprintEntity = (this.layer.entities as any).add({
|
|
2395
|
-
// polygon: {
|
|
2396
|
-
// // Only show when we have at least 3 ground hit points
|
|
2397
|
-
// show: new C.CallbackProperty(() => (this._footprintPositions?.length ?? 0) >= 3, false),
|
|
2398
|
-
// hierarchy: new C.CallbackProperty(() => {
|
|
2399
|
-
// const arr = this._footprintPositions;
|
|
2400
|
-
// return arr && arr.length >= 3 ? arr.slice() : undefined;
|
|
2401
|
-
// }, false),
|
|
2402
|
-
// material: C.Color.CYAN.withAlpha(0.18),
|
|
2403
|
-
// outline: true,
|
|
2404
|
-
// outlineColor: C.Color.CYAN.withAlpha(0.7),
|
|
2405
|
-
// outlineWidth: 1,
|
|
2406
|
-
// // Use per-position heights from globe intersections to avoid terrain-ground primitive path
|
|
2407
|
-
// perPositionHeight: true,
|
|
2408
|
-
// },
|
|
2409
|
-
// properties: { _type: 'preview-footprint' },
|
|
2410
|
-
// });
|
|
2411
|
-
// }
|
|
2412
|
-
// private _footprintPositions: any[] | undefined;
|
|
2413
2394
|
/**
|
|
2414
2395
|
* Set the camera pose and field of view for the overlay viewer.
|
|
2415
2396
|
* @param cartesian cartesian position
|
|
@@ -2429,29 +2410,6 @@ var PathPreview = class {
|
|
|
2429
2410
|
orientation: { heading: h2, pitch: p, roll: r }
|
|
2430
2411
|
});
|
|
2431
2412
|
}
|
|
2432
|
-
// // Recompute footprint using overlay scene
|
|
2433
|
-
// try {
|
|
2434
|
-
// const scene: any = v.scene;
|
|
2435
|
-
// const w = scene?.canvas?.width ?? 256;
|
|
2436
|
-
// const hgt = scene?.canvas?.height ?? 144;
|
|
2437
|
-
// const corners = [
|
|
2438
|
-
// new C.Cartesian2(2, 2),
|
|
2439
|
-
// new C.Cartesian2(w - 2, 2),
|
|
2440
|
-
// new C.Cartesian2(w - 2, hgt - 2),
|
|
2441
|
-
// new C.Cartesian2(2, hgt - 2),
|
|
2442
|
-
// ];
|
|
2443
|
-
// const pts: any[] = [];
|
|
2444
|
-
// for (const c of corners) {
|
|
2445
|
-
// const ray = v.camera.getPickRay(c);
|
|
2446
|
-
// if (!ray) continue;
|
|
2447
|
-
// const hit = scene.globe?.pick?.(ray, scene);
|
|
2448
|
-
// if (hit) pts.push(hit);
|
|
2449
|
-
// }
|
|
2450
|
-
// // this._footprintPositions = pts.length >= 3 ? pts : undefined;
|
|
2451
|
-
// v.scene?.requestRender?.();
|
|
2452
|
-
// (this.mainViewer.scene as any)?.requestRender?.();
|
|
2453
|
-
// } catch {}
|
|
2454
|
-
// }
|
|
2455
2413
|
/**
|
|
2456
2414
|
* 设置 FOV(如果启用了 FOV 控制器)
|
|
2457
2415
|
*/
|
|
@@ -2518,7 +2476,6 @@ var PathPreview = class {
|
|
|
2518
2476
|
} catch {
|
|
2519
2477
|
}
|
|
2520
2478
|
this.fovController = void 0;
|
|
2521
|
-
this.footprintEntity = void 0;
|
|
2522
2479
|
try {
|
|
2523
2480
|
this.toggleBtn?.remove();
|
|
2524
2481
|
} catch {
|
|
@@ -2577,7 +2534,7 @@ var FrustumPyramid = class {
|
|
|
2577
2534
|
*/
|
|
2578
2535
|
computeFrustumGeometry(apex, headingDeg, pitchDeg, rollDeg, fovDeg, length) {
|
|
2579
2536
|
const C = this.CesiumNS;
|
|
2580
|
-
const fov = Math.max(1, Math.min(120, fovDeg ?? this.opts.fov ??
|
|
2537
|
+
const fov = Math.max(1, Math.min(120, fovDeg ?? this.opts.fov ?? DEFAULT_FOV));
|
|
2581
2538
|
const aspectRatio = this.opts.aspectRatio ?? 4 / 3;
|
|
2582
2539
|
const halfFovH = C.Math.toRadians(fov / 2);
|
|
2583
2540
|
const halfWidth = Math.tan(halfFovH) * length;
|
|
@@ -2756,7 +2713,7 @@ var FrustumPyramid = class {
|
|
|
2756
2713
|
const lakeFill = (this.opts.fillColor ?? C.Color.fromCssColorString("#1e90ff")).withAlpha(alpha);
|
|
2757
2714
|
const width = this.opts.width ?? 3;
|
|
2758
2715
|
this.ensureEntities(lakeEdge, width, lakeFill);
|
|
2759
|
-
const effectiveFov = Math.max(1, Math.min(120, fovDeg ?? this.opts.fov ??
|
|
2716
|
+
const effectiveFov = Math.max(1, Math.min(120, fovDeg ?? this.opts.fov ?? DEFAULT_FOV));
|
|
2760
2717
|
const aspectRatio = this.opts.aspectRatio ?? 4 / 3;
|
|
2761
2718
|
this.logAnglesIfChanged(effectiveFov, aspectRatio, headingDeg, pitchDeg);
|
|
2762
2719
|
const { apex: apexPos, corners, baseCenter } = this.computeFrustumGeometry(
|
|
@@ -2960,7 +2917,7 @@ var AirplaneCursor = class {
|
|
|
2960
2917
|
this.step = opts.stepMeters ?? 2;
|
|
2961
2918
|
this.angleStep = opts.angleStepDeg ?? 1;
|
|
2962
2919
|
this.fastFactor = opts.fastFactor ?? 5;
|
|
2963
|
-
this.currentFOV = opts.fovDeg ??
|
|
2920
|
+
this.currentFOV = opts.fovDeg ?? DEFAULT_FOV;
|
|
2964
2921
|
this.ensureEntity(opts.color ?? C.Color.CYAN.withAlpha(0.9));
|
|
2965
2922
|
this.attachKeyboard(opts);
|
|
2966
2923
|
this.setupFOVListener();
|
|
@@ -3238,8 +3195,8 @@ var AirplaneCursor = class {
|
|
|
3238
3195
|
this.viewer.dataSources.add(layer);
|
|
3239
3196
|
}
|
|
3240
3197
|
this.frustum = new FrustumPyramid(this.CesiumNS, layer, {
|
|
3241
|
-
fov: this.opts.fovDeg ??
|
|
3242
|
-
//
|
|
3198
|
+
fov: this.opts.fovDeg ?? DEFAULT_FOV,
|
|
3199
|
+
// 使用统一的默认 FOV
|
|
3243
3200
|
length: 80,
|
|
3244
3201
|
color: this.opts.color,
|
|
3245
3202
|
fillAlpha: 0.25,
|
|
@@ -3248,8 +3205,8 @@ var AirplaneCursor = class {
|
|
|
3248
3205
|
logAngles: false,
|
|
3249
3206
|
logThrottleMs: 300
|
|
3250
3207
|
});
|
|
3251
|
-
const frustumFovScale = 0.
|
|
3252
|
-
const frustumLengthScale = 0.
|
|
3208
|
+
const frustumFovScale = 0.5;
|
|
3209
|
+
const frustumLengthScale = 0.2;
|
|
3253
3210
|
this.frustum.showAtDynamic(
|
|
3254
3211
|
() => this.pose.position,
|
|
3255
3212
|
() => this.pose.heading,
|
|
@@ -5330,11 +5287,11 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
|
|
|
5330
5287
|
const fArr = getArr("_vertexFov");
|
|
5331
5288
|
pitches[i] = typeof pArr?.[i] === "number" ? pArr[i] : -10;
|
|
5332
5289
|
rolls[i] = typeof rArr?.[i] === "number" ? rArr[i] : 0;
|
|
5333
|
-
fovs[i] = typeof fArr?.[i] === "number" ? fArr[i] :
|
|
5290
|
+
fovs[i] = typeof fArr?.[i] === "number" ? fArr[i] : DEFAULT_FOV;
|
|
5334
5291
|
} catch {
|
|
5335
5292
|
pitches[i] = -10;
|
|
5336
5293
|
rolls[i] = 0;
|
|
5337
|
-
fovs[i] =
|
|
5294
|
+
fovs[i] = DEFAULT_FOV;
|
|
5338
5295
|
}
|
|
5339
5296
|
}
|
|
5340
5297
|
entity.polyline.positions = new C.CallbackProperty(() => positions.slice(), false);
|
|
@@ -5363,7 +5320,7 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
|
|
|
5363
5320
|
headings[activeIndex] ?? 0,
|
|
5364
5321
|
pitches[activeIndex] ?? -10,
|
|
5365
5322
|
0,
|
|
5366
|
-
fovs[activeIndex] ??
|
|
5323
|
+
fovs[activeIndex] ?? DEFAULT_FOV
|
|
5367
5324
|
);
|
|
5368
5325
|
}
|
|
5369
5326
|
} catch {
|
|
@@ -5539,13 +5496,13 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
|
|
|
5539
5496
|
}
|
|
5540
5497
|
},
|
|
5541
5498
|
// frustumLengthFactor: options?.preview?.lengthFactor ?? 0.3,
|
|
5542
|
-
fovDeg: options?.preview?.fov ??
|
|
5499
|
+
fovDeg: options?.preview?.fov ?? DEFAULT_FOV
|
|
5543
5500
|
});
|
|
5544
5501
|
if (options?.preview?.enabled !== false && airplaneCursor) {
|
|
5545
5502
|
preview = new PathPreview(CesiumNS, viewer, {
|
|
5546
5503
|
container: options?.preview?.container,
|
|
5547
5504
|
showFootprint: options?.preview?.showFootprint ?? false,
|
|
5548
|
-
fov: options?.preview?.fov ??
|
|
5505
|
+
fov: options?.preview?.fov ?? DEFAULT_FOV,
|
|
5549
5506
|
pitch: options?.preview?.pitch ?? -10,
|
|
5550
5507
|
roll: options?.preview?.roll ?? 0
|
|
5551
5508
|
});
|
|
@@ -5557,7 +5514,7 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
|
|
|
5557
5514
|
initialPose.heading,
|
|
5558
5515
|
initialPose.pitch,
|
|
5559
5516
|
initialPose.roll,
|
|
5560
|
-
options?.preview?.fov ??
|
|
5517
|
+
options?.preview?.fov ?? DEFAULT_FOV
|
|
5561
5518
|
);
|
|
5562
5519
|
} catch {
|
|
5563
5520
|
console.warn("PathEditing: failed to set initial preview pose");
|
|
@@ -5815,7 +5772,7 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
|
|
|
5815
5772
|
heading: headings[index] ?? 0,
|
|
5816
5773
|
pitch: pitches[index] ?? 0,
|
|
5817
5774
|
roll: rolls[index] ?? 0,
|
|
5818
|
-
fov: fovs[index] ??
|
|
5775
|
+
fov: fovs[index] ?? DEFAULT_FOV
|
|
5819
5776
|
};
|
|
5820
5777
|
const totalVertices = positions.length;
|
|
5821
5778
|
const totalVisibleVertices = totalVertices;
|
|
@@ -5889,7 +5846,7 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
|
|
|
5889
5846
|
heading: headings[index] ?? 0,
|
|
5890
5847
|
pitch: pitches[index] ?? -10,
|
|
5891
5848
|
roll: rolls[index] ?? 0,
|
|
5892
|
-
fov: fovs[index] ??
|
|
5849
|
+
fov: fovs[index] ?? DEFAULT_FOV,
|
|
5893
5850
|
index,
|
|
5894
5851
|
distance: calculatePathDistance(CesiumNS, positions, index),
|
|
5895
5852
|
ellipsoidHeight,
|
|
@@ -6359,7 +6316,7 @@ function startPathDrawing(CesiumNS, viewer, options, onComplete) {
|
|
|
6359
6316
|
try {
|
|
6360
6317
|
const auto = options?.autoStartEditing;
|
|
6361
6318
|
const editOptions = {
|
|
6362
|
-
//
|
|
6319
|
+
// 默认使用自由编辑模式(快速编辑和自由编辑互斥)
|
|
6363
6320
|
quickEdit: false
|
|
6364
6321
|
};
|
|
6365
6322
|
if (typeof auto === "object" && auto.preview) {
|