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