@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 CHANGED
@@ -13,7 +13,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
13
13
  // package.json
14
14
  var package_default = {
15
15
  name: "@jorgmoritz/gis-manager",
16
- version: "0.1.38"};
16
+ version: "0.1.40"};
17
17
 
18
18
  // src/utils/version.ts
19
19
  var version = package_default.version;
@@ -1553,6 +1553,11 @@ var HeightMarker = class {
1553
1553
  }
1554
1554
  };
1555
1555
 
1556
+ // src/core/path-manager/constants.ts
1557
+ var DEFAULT_FOV = 172;
1558
+ var SENSOR_WIDTH = 36;
1559
+ var FOCAL_LENGTH_PRESETS = [112, 56, 14, 7, 3, 1];
1560
+
1556
1561
  // src/core/path-manager/CameraFOVController.ts
1557
1562
  var CameraFOVController = class {
1558
1563
  constructor(opts = {}) {
@@ -1584,8 +1589,8 @@ var CameraFOVController = class {
1584
1589
  this.updateDisplay();
1585
1590
  this.emitChange();
1586
1591
  });
1587
- this.sensorWidth = opts.sensorWidth ?? 36;
1588
- this.focalLengthPresets = opts.focalLengthPresets ?? [112, 56, 14, 7, 3, 1];
1592
+ this.sensorWidth = opts.sensorWidth ?? SENSOR_WIDTH;
1593
+ this.focalLengthPresets = opts.focalLengthPresets ?? FOCAL_LENGTH_PRESETS;
1589
1594
  if (opts.minFOV === void 0 || opts.maxFOV === void 0) {
1590
1595
  const minFocalLength = Math.min(...this.focalLengthPresets);
1591
1596
  const maxFocalLength = Math.max(...this.focalLengthPresets);
@@ -1595,7 +1600,7 @@ var CameraFOVController = class {
1595
1600
  this.minFOV = opts.minFOV;
1596
1601
  this.maxFOV = opts.maxFOV;
1597
1602
  }
1598
- this.currentFOV = opts.initialFOV ?? this.focalLengthToFOVDirect(1);
1603
+ this.currentFOV = opts.initialFOV ?? DEFAULT_FOV;
1599
1604
  this.useGlobalEventBus = opts.useGlobalEventBus ?? true;
1600
1605
  this.createUI();
1601
1606
  this.setupExternalFOVListener();
@@ -1954,8 +1959,6 @@ var PathPreview = class {
1954
1959
  // Lightweight overlay viewer
1955
1960
  __publicField(this, "containerEl");
1956
1961
  // Container for the overlay viewer
1957
- __publicField(this, "footprintEntity");
1958
- // Entity for ground footprint polygon
1959
1962
  __publicField(this, "destroyed", false);
1960
1963
  // Track if the instance has been destroyed
1961
1964
  __publicField(this, "fovController");
@@ -1967,7 +1970,7 @@ var PathPreview = class {
1967
1970
  __publicField(this, "toggleBtn");
1968
1971
  /** 已加载的 3D Tiles 实例(预览窗口独立的) */
1969
1972
  __publicField(this, "tilesets", /* @__PURE__ */ new Map());
1970
- this.currentFOV = opts.fov ?? 50;
1973
+ this.currentFOV = opts.fov ?? DEFAULT_FOV;
1971
1974
  this.ensureViewer();
1972
1975
  this.ensureFOVController();
1973
1976
  }
@@ -2432,28 +2435,6 @@ var PathPreview = class {
2432
2435
  console.warn("[PathPreview] Failed to update FOV:", e);
2433
2436
  }
2434
2437
  }
2435
- // private ensureFootprint(): void {
2436
- // const C: any = this.CesiumNS as any;
2437
- // if (this.footprintEntity) return;
2438
- // this.footprintEntity = (this.layer.entities as any).add({
2439
- // polygon: {
2440
- // // Only show when we have at least 3 ground hit points
2441
- // show: new C.CallbackProperty(() => (this._footprintPositions?.length ?? 0) >= 3, false),
2442
- // hierarchy: new C.CallbackProperty(() => {
2443
- // const arr = this._footprintPositions;
2444
- // return arr && arr.length >= 3 ? arr.slice() : undefined;
2445
- // }, false),
2446
- // material: C.Color.CYAN.withAlpha(0.18),
2447
- // outline: true,
2448
- // outlineColor: C.Color.CYAN.withAlpha(0.7),
2449
- // outlineWidth: 1,
2450
- // // Use per-position heights from globe intersections to avoid terrain-ground primitive path
2451
- // perPositionHeight: true,
2452
- // },
2453
- // properties: { _type: 'preview-footprint' },
2454
- // });
2455
- // }
2456
- // private _footprintPositions: any[] | undefined;
2457
2438
  /**
2458
2439
  * Set the camera pose and field of view for the overlay viewer.
2459
2440
  * @param cartesian cartesian position
@@ -2473,29 +2454,6 @@ var PathPreview = class {
2473
2454
  orientation: { heading: h, pitch: p, roll: r }
2474
2455
  });
2475
2456
  }
2476
- // // Recompute footprint using overlay scene
2477
- // try {
2478
- // const scene: any = v.scene;
2479
- // const w = scene?.canvas?.width ?? 256;
2480
- // const hgt = scene?.canvas?.height ?? 144;
2481
- // const corners = [
2482
- // new C.Cartesian2(2, 2),
2483
- // new C.Cartesian2(w - 2, 2),
2484
- // new C.Cartesian2(w - 2, hgt - 2),
2485
- // new C.Cartesian2(2, hgt - 2),
2486
- // ];
2487
- // const pts: any[] = [];
2488
- // for (const c of corners) {
2489
- // const ray = v.camera.getPickRay(c);
2490
- // if (!ray) continue;
2491
- // const hit = scene.globe?.pick?.(ray, scene);
2492
- // if (hit) pts.push(hit);
2493
- // }
2494
- // // this._footprintPositions = pts.length >= 3 ? pts : undefined;
2495
- // v.scene?.requestRender?.();
2496
- // (this.mainViewer.scene as any)?.requestRender?.();
2497
- // } catch {}
2498
- // }
2499
2457
  /**
2500
2458
  * 设置 FOV(如果启用了 FOV 控制器)
2501
2459
  */
@@ -2562,7 +2520,6 @@ var PathPreview = class {
2562
2520
  } catch {
2563
2521
  }
2564
2522
  this.fovController = void 0;
2565
- this.footprintEntity = void 0;
2566
2523
  try {
2567
2524
  this.toggleBtn?.remove();
2568
2525
  } catch {
@@ -2621,7 +2578,7 @@ var FrustumPyramid = class {
2621
2578
  */
2622
2579
  computeFrustumGeometry(apex, headingDeg, pitchDeg, rollDeg, fovDeg, length) {
2623
2580
  const C = this.CesiumNS;
2624
- const fov = Math.max(1, Math.min(120, fovDeg ?? this.opts.fov ?? 50));
2581
+ const fov = Math.max(1, Math.min(120, fovDeg ?? this.opts.fov ?? DEFAULT_FOV));
2625
2582
  const aspectRatio = this.opts.aspectRatio ?? 4 / 3;
2626
2583
  const halfFovH = C.Math.toRadians(fov / 2);
2627
2584
  const halfWidth = Math.tan(halfFovH) * length;
@@ -2800,7 +2757,7 @@ var FrustumPyramid = class {
2800
2757
  const lakeFill = (this.opts.fillColor ?? C.Color.fromCssColorString("#1e90ff")).withAlpha(alpha);
2801
2758
  const width = this.opts.width ?? 3;
2802
2759
  this.ensureEntities(lakeEdge, width, lakeFill);
2803
- const effectiveFov = Math.max(1, Math.min(120, fovDeg ?? this.opts.fov ?? 50));
2760
+ const effectiveFov = Math.max(1, Math.min(120, fovDeg ?? this.opts.fov ?? DEFAULT_FOV));
2804
2761
  const aspectRatio = this.opts.aspectRatio ?? 4 / 3;
2805
2762
  this.logAnglesIfChanged(effectiveFov, aspectRatio, headingDeg, pitchDeg);
2806
2763
  const { apex: apexPos, corners, baseCenter } = this.computeFrustumGeometry(
@@ -3004,7 +2961,7 @@ var AirplaneCursor = class {
3004
2961
  this.step = opts.stepMeters ?? 2;
3005
2962
  this.angleStep = opts.angleStepDeg ?? 1;
3006
2963
  this.fastFactor = opts.fastFactor ?? 5;
3007
- this.currentFOV = opts.fovDeg ?? 172;
2964
+ this.currentFOV = opts.fovDeg ?? DEFAULT_FOV;
3008
2965
  this.ensureEntity(opts.color ?? C.Color.CYAN.withAlpha(0.9));
3009
2966
  this.attachKeyboard(opts);
3010
2967
  this.setupFOVListener();
@@ -3282,8 +3239,8 @@ var AirplaneCursor = class {
3282
3239
  this.viewer.dataSources.add(layer);
3283
3240
  }
3284
3241
  this.frustum = new FrustumPyramid(this.CesiumNS, layer, {
3285
- fov: this.opts.fovDeg ?? 172,
3286
- // 默认 1mm 焦距对应的 FOV
3242
+ fov: this.opts.fovDeg ?? DEFAULT_FOV,
3243
+ // 使用统一的默认 FOV
3287
3244
  length: 80,
3288
3245
  color: this.opts.color,
3289
3246
  fillAlpha: 0.25,
@@ -3292,8 +3249,8 @@ var AirplaneCursor = class {
3292
3249
  logAngles: false,
3293
3250
  logThrottleMs: 300
3294
3251
  });
3295
- const frustumFovScale = 0.6;
3296
- const frustumLengthScale = 0.1;
3252
+ const frustumFovScale = 0.5;
3253
+ const frustumLengthScale = 0.2;
3297
3254
  this.frustum.showAtDynamic(
3298
3255
  () => this.pose.position,
3299
3256
  () => this.pose.heading,
@@ -5378,11 +5335,11 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5378
5335
  const fArr = getArr("_vertexFov");
5379
5336
  pitches[i] = typeof pArr?.[i] === "number" ? pArr[i] : -10;
5380
5337
  rolls[i] = typeof rArr?.[i] === "number" ? rArr[i] : 0;
5381
- fovs[i] = typeof fArr?.[i] === "number" ? fArr[i] : 50;
5338
+ fovs[i] = typeof fArr?.[i] === "number" ? fArr[i] : DEFAULT_FOV;
5382
5339
  } catch {
5383
5340
  pitches[i] = -10;
5384
5341
  rolls[i] = 0;
5385
- fovs[i] = 50;
5342
+ fovs[i] = DEFAULT_FOV;
5386
5343
  }
5387
5344
  }
5388
5345
  entity.polyline.positions = new C.CallbackProperty(() => positions.slice(), false);
@@ -5411,7 +5368,7 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5411
5368
  headings[activeIndex] ?? 0,
5412
5369
  pitches[activeIndex] ?? -10,
5413
5370
  0,
5414
- fovs[activeIndex] ?? 50
5371
+ fovs[activeIndex] ?? DEFAULT_FOV
5415
5372
  );
5416
5373
  }
5417
5374
  } catch {
@@ -5587,13 +5544,13 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5587
5544
  }
5588
5545
  },
5589
5546
  // frustumLengthFactor: options?.preview?.lengthFactor ?? 0.3,
5590
- fovDeg: options?.preview?.fov ?? 50
5547
+ fovDeg: options?.preview?.fov ?? DEFAULT_FOV
5591
5548
  });
5592
5549
  if (options?.preview?.enabled !== false && airplaneCursor) {
5593
5550
  preview = new PathPreview(CesiumNS, viewer, {
5594
5551
  container: options?.preview?.container,
5595
5552
  showFootprint: options?.preview?.showFootprint ?? false,
5596
- fov: options?.preview?.fov ?? 50,
5553
+ fov: options?.preview?.fov ?? DEFAULT_FOV,
5597
5554
  pitch: options?.preview?.pitch ?? -10,
5598
5555
  roll: options?.preview?.roll ?? 0
5599
5556
  });
@@ -5605,7 +5562,7 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5605
5562
  initialPose.heading,
5606
5563
  initialPose.pitch,
5607
5564
  initialPose.roll,
5608
- options?.preview?.fov ?? 50
5565
+ options?.preview?.fov ?? DEFAULT_FOV
5609
5566
  );
5610
5567
  } catch {
5611
5568
  console.warn("PathEditing: failed to set initial preview pose");
@@ -5863,7 +5820,7 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5863
5820
  heading: headings[index] ?? 0,
5864
5821
  pitch: pitches[index] ?? 0,
5865
5822
  roll: rolls[index] ?? 0,
5866
- fov: fovs[index] ?? 50
5823
+ fov: fovs[index] ?? DEFAULT_FOV
5867
5824
  };
5868
5825
  const totalVertices = positions.length;
5869
5826
  const totalVisibleVertices = totalVertices;
@@ -5937,7 +5894,7 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5937
5894
  heading: headings[index] ?? 0,
5938
5895
  pitch: pitches[index] ?? -10,
5939
5896
  roll: rolls[index] ?? 0,
5940
- fov: fovs[index] ?? 50,
5897
+ fov: fovs[index] ?? DEFAULT_FOV,
5941
5898
  index,
5942
5899
  distance: calculatePathDistance(CesiumNS, positions, index),
5943
5900
  ellipsoidHeight,
@@ -6407,7 +6364,7 @@ function startPathDrawing(CesiumNS, viewer, options, onComplete) {
6407
6364
  try {
6408
6365
  const auto = options?.autoStartEditing;
6409
6366
  const editOptions = {
6410
- // 🔧 默认使用自由编辑模式(快速编辑和自由编辑互斥)
6367
+ // 默认使用自由编辑模式(快速编辑和自由编辑互斥)
6411
6368
  quickEdit: false
6412
6369
  };
6413
6370
  if (typeof auto === "object" && auto.preview) {
@@ -11875,6 +11832,7 @@ var PathSafetyChecker = class {
11875
11832
 
11876
11833
  // src/index.ts
11877
11834
  var placeholder = { ready: true };
11835
+ var droneModelUrl = wurenji_default;
11878
11836
 
11879
11837
  exports.CZMLManager = CZMLManager;
11880
11838
  exports.CameraEventBus = CameraEventBus;
@@ -11898,6 +11856,7 @@ exports.configureCesiumIonToken = configureCesiumIonToken;
11898
11856
  exports.convertPathToSinofly = convertPathToSinofly;
11899
11857
  exports.convertSinoflyWayline = convertSinoflyWayline;
11900
11858
  exports.convertSinoflyWaylines = convertSinoflyWaylines;
11859
+ exports.droneModelUrl = droneModelUrl;
11901
11860
  exports.ensureCesiumIonToken = ensureCesiumIonToken;
11902
11861
  exports.getCesiumBaseUrl = getCesiumBaseUrl;
11903
11862
  exports.getCesiumIonToken = getCesiumIonToken;