@jorgmoritz/gis-manager 0.1.44 → 0.1.45

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.d.cts CHANGED
@@ -2636,6 +2636,100 @@ declare function calculateMidpoint(CesiumNS: typeof Cesium, point1: Cesium.Carte
2636
2636
  */
2637
2637
  declare function calculateHeadingBetweenPoints(CesiumNS: typeof Cesium, point1: Cesium.Cartesian3, point2: Cesium.Cartesian3): number;
2638
2638
 
2639
+ /**
2640
+ * 实时航点数据
2641
+ */
2642
+ interface RealtimeWaypoint {
2643
+ longitude: number;
2644
+ latitude: number;
2645
+ altitude: number;
2646
+ heading?: number;
2647
+ pitch?: number;
2648
+ roll?: number;
2649
+ timestamp?: number;
2650
+ }
2651
+ /**
2652
+ * 轨迹样式选项
2653
+ */
2654
+ interface TrackStyleOptions {
2655
+ /** 轨迹颜色 */
2656
+ color?: Cesium.Color;
2657
+ /** 轨迹线宽 */
2658
+ width?: number;
2659
+ /** 是否贴地 */
2660
+ clampToGround?: boolean;
2661
+ /** 最大轨迹点数(防止内存溢出),默认 1000 */
2662
+ maxPoints?: number;
2663
+ }
2664
+ /**
2665
+ * 实时飞行追踪器选项
2666
+ */
2667
+ interface RealtimeFlightTrackerOptions {
2668
+ /** 是否显示飞过的轨迹,默认 true */
2669
+ showTrack?: boolean;
2670
+ /** 轨迹样式 */
2671
+ trackStyle?: TrackStyleOptions;
2672
+ /** 视锥体角度,默认 50 */
2673
+ fovDeg?: number;
2674
+ /** 自定义图层 */
2675
+ layer?: Cesium.CustomDataSource;
2676
+ }
2677
+ /**
2678
+ * 实时飞行追踪器
2679
+ *
2680
+ * 用于接收 WebSocket 推送的实时航点数据,更新飞机位置并绘制飞过的轨迹
2681
+ */
2682
+ declare class RealtimeFlightTracker {
2683
+ private CesiumNS;
2684
+ private viewer;
2685
+ private options;
2686
+ private airplaneCursor?;
2687
+ private trackEntity?;
2688
+ private trackPositions;
2689
+ private isInitialized;
2690
+ constructor(CesiumNS: typeof Cesium, viewer: Cesium.Viewer, options?: RealtimeFlightTrackerOptions);
2691
+ /**
2692
+ * 更新飞机位置(接收新航点)
2693
+ * @param waypoint 实时航点数据
2694
+ */
2695
+ updatePosition(waypoint: RealtimeWaypoint): void;
2696
+ /**
2697
+ * 初始化飞机和轨迹实体
2698
+ */
2699
+ private initialize;
2700
+ /**
2701
+ * 创建轨迹实体
2702
+ */
2703
+ private createTrackEntity;
2704
+ /**
2705
+ * 添加轨迹点
2706
+ */
2707
+ private addTrackPoint;
2708
+ /**
2709
+ * 清除轨迹
2710
+ */
2711
+ clearTrack(): void;
2712
+ /**
2713
+ * 获取当前轨迹点数
2714
+ */
2715
+ getTrackPointCount(): number;
2716
+ /**
2717
+ * 设置轨迹可见性
2718
+ */
2719
+ setTrackVisible(visible: boolean): void;
2720
+ /**
2721
+ * 飞到当前飞机位置
2722
+ */
2723
+ flyToAirplane(options?: {
2724
+ height?: number;
2725
+ duration?: number;
2726
+ }): void;
2727
+ /**
2728
+ * 销毁并清理资源
2729
+ */
2730
+ destroy(): void;
2731
+ }
2732
+
2639
2733
  /**
2640
2734
  * Path 编辑保存结果数据接口
2641
2735
  * 对应 pathEditing.ts 中 saveAndStop() 返回的数据结构
@@ -2864,4 +2958,4 @@ declare const placeholder: {
2864
2958
  };
2865
2959
  declare const droneModelUrl: string;
2866
2960
 
2867
- export { type AltitudeMode, CZMLManager, type CameraDestinationInput, CameraEventBus, type CameraFOVChangeEvent, CameraFOVController, type CameraFlyOptions, type CameraInitOptions, CameraManager, type CameraOrientation, type CameraPoseChangeEvent, type CameraSetViewOptions, type CameraView, type CaptureWithViewOptions, type CesiumAssetsOptions, type ConvertedWaylineData, type ConvertedWaypointData, type CursorPoseChangeEvent, type CzmlExportOptions, type CzmlImportOptions, type EditingChange, Emitter, type FOVChangeEvent, type FOVControllerOptions, type FlightPathPreviewController, FlightSimulator, type FlightSimulatorController, type FlightSimulatorOptions, type FlightSimulatorState, type FlightSimulatorStateChangeEvent, type FlyToBoundsOptions, type FlyToOptions, FrustumPyramid, type FrustumPyramidOptions, type FrustumShapeChangeEvent, type GeoBounds, type GeoPoint, type ImageryOptions, type ImageryProviderKind, type InitOptions, type LayerEvents, type LayerHandle, LayerManager, type LayerType, type Listener, type LoadMapLayersResult, type LoadSliceJsonOptions, type LoadSliceJsonResult, type LonLatHeight, type MapLayerConfig, type Orientation, type PathEditingSaveResult, type PathOptions, type PathSafetyCheckOptions, type PathSafetyCheckResult, PathSafetyChecker, type PathToSinoflyOptions, type PhotoBillboardItem, type PhotoBillboardLayerOptions, type PhotoBillboardResult, type PointCloudPickResult, type PointCloudPickSession, PointCloudPicker, type PointCloudPickerOptions, type PolygonDrawingOptions, type PolygonEditingSession, PolygonEditor, type PreviousViewChange, type QuickEditOptions, type RenderFlightPathOptions, type RenderFlightPathPreviewOptions, SceneManager, type SceneOptions, type ScreenshotOptions, type ScreenshotResult, type SegmentSafetyResult, type SelectionChange, type SelectionResult, type SelectionSession, Selector, type ShapeLineProps, type ShapePointProps, type ShapePolygonProps, type SinoflyAdapterOptions, type SinoflyWaylineData, type SinoflyWaypointInfo, type SliceJsonData, StateManager, type TerrainKind, type TerrainOptions, type Toggle2D3DContext, type Toggle2D3DOptions, type VersionInfo, assertCesiumAssetsConfigured, calculateAbsoluteHeight, calculateBoundsDiagonal, calculateDistance, calculateDistanceAndMidpoint, calculateGeoBounds, calculateHeadingBetweenPoints, calculateMidpoint, calculateRelativeHeight, configureCesiumAssets, configureCesiumIonToken, convertPathToSinofly, convertSinoflyWayline, convertSinoflyWaylines, droneModelUrl, ensureCesiumIonToken, expandBounds, getCesiumBaseUrl, getCesiumIonToken, globalCameraEventBus, globalState, isPointInBounds, mergeBounds, placeholder, queryTerrainHeightAsync, queryTerrainHeightByLonLat, queryTerrainHeightByLonLatSync, queryTerrainHeightSync, queryTerrainHeights, queryTerrainHeightsByLonLat, renderFlightPath, renderFlightPathPreview, toggle2D3D, version, versionInfo };
2961
+ export { type AltitudeMode, CZMLManager, type CameraDestinationInput, CameraEventBus, type CameraFOVChangeEvent, CameraFOVController, type CameraFlyOptions, type CameraInitOptions, CameraManager, type CameraOrientation, type CameraPoseChangeEvent, type CameraSetViewOptions, type CameraView, type CaptureWithViewOptions, type CesiumAssetsOptions, type ConvertedWaylineData, type ConvertedWaypointData, type CursorPoseChangeEvent, type CzmlExportOptions, type CzmlImportOptions, type EditingChange, Emitter, type FOVChangeEvent, type FOVControllerOptions, type FlightPathPreviewController, FlightSimulator, type FlightSimulatorController, type FlightSimulatorOptions, type FlightSimulatorState, type FlightSimulatorStateChangeEvent, type FlyToBoundsOptions, type FlyToOptions, FrustumPyramid, type FrustumPyramidOptions, type FrustumShapeChangeEvent, type GeoBounds, type GeoPoint, type ImageryOptions, type ImageryProviderKind, type InitOptions, type LayerEvents, type LayerHandle, LayerManager, type LayerType, type Listener, type LoadMapLayersResult, type LoadSliceJsonOptions, type LoadSliceJsonResult, type LonLatHeight, type MapLayerConfig, type Orientation, type PathEditingSaveResult, type PathOptions, type PathSafetyCheckOptions, type PathSafetyCheckResult, PathSafetyChecker, type PathToSinoflyOptions, type PhotoBillboardItem, type PhotoBillboardLayerOptions, type PhotoBillboardResult, type PointCloudPickResult, type PointCloudPickSession, PointCloudPicker, type PointCloudPickerOptions, type PolygonDrawingOptions, type PolygonEditingSession, PolygonEditor, type PreviousViewChange, type QuickEditOptions, RealtimeFlightTracker, type RealtimeFlightTrackerOptions, type RealtimeWaypoint, type RenderFlightPathOptions, type RenderFlightPathPreviewOptions, SceneManager, type SceneOptions, type ScreenshotOptions, type ScreenshotResult, type SegmentSafetyResult, type SelectionChange, type SelectionResult, type SelectionSession, Selector, type ShapeLineProps, type ShapePointProps, type ShapePolygonProps, type SinoflyAdapterOptions, type SinoflyWaylineData, type SinoflyWaypointInfo, type SliceJsonData, StateManager, type TerrainKind, type TerrainOptions, type Toggle2D3DContext, type Toggle2D3DOptions, type TrackStyleOptions, type VersionInfo, assertCesiumAssetsConfigured, calculateAbsoluteHeight, calculateBoundsDiagonal, calculateDistance, calculateDistanceAndMidpoint, calculateGeoBounds, calculateHeadingBetweenPoints, calculateMidpoint, calculateRelativeHeight, configureCesiumAssets, configureCesiumIonToken, convertPathToSinofly, convertSinoflyWayline, convertSinoflyWaylines, droneModelUrl, ensureCesiumIonToken, expandBounds, getCesiumBaseUrl, getCesiumIonToken, globalCameraEventBus, globalState, isPointInBounds, mergeBounds, placeholder, queryTerrainHeightAsync, queryTerrainHeightByLonLat, queryTerrainHeightByLonLatSync, queryTerrainHeightSync, queryTerrainHeights, queryTerrainHeightsByLonLat, renderFlightPath, renderFlightPathPreview, toggle2D3D, version, versionInfo };
package/dist/index.d.ts CHANGED
@@ -2636,6 +2636,100 @@ declare function calculateMidpoint(CesiumNS: typeof Cesium, point1: Cesium.Carte
2636
2636
  */
2637
2637
  declare function calculateHeadingBetweenPoints(CesiumNS: typeof Cesium, point1: Cesium.Cartesian3, point2: Cesium.Cartesian3): number;
2638
2638
 
2639
+ /**
2640
+ * 实时航点数据
2641
+ */
2642
+ interface RealtimeWaypoint {
2643
+ longitude: number;
2644
+ latitude: number;
2645
+ altitude: number;
2646
+ heading?: number;
2647
+ pitch?: number;
2648
+ roll?: number;
2649
+ timestamp?: number;
2650
+ }
2651
+ /**
2652
+ * 轨迹样式选项
2653
+ */
2654
+ interface TrackStyleOptions {
2655
+ /** 轨迹颜色 */
2656
+ color?: Cesium.Color;
2657
+ /** 轨迹线宽 */
2658
+ width?: number;
2659
+ /** 是否贴地 */
2660
+ clampToGround?: boolean;
2661
+ /** 最大轨迹点数(防止内存溢出),默认 1000 */
2662
+ maxPoints?: number;
2663
+ }
2664
+ /**
2665
+ * 实时飞行追踪器选项
2666
+ */
2667
+ interface RealtimeFlightTrackerOptions {
2668
+ /** 是否显示飞过的轨迹,默认 true */
2669
+ showTrack?: boolean;
2670
+ /** 轨迹样式 */
2671
+ trackStyle?: TrackStyleOptions;
2672
+ /** 视锥体角度,默认 50 */
2673
+ fovDeg?: number;
2674
+ /** 自定义图层 */
2675
+ layer?: Cesium.CustomDataSource;
2676
+ }
2677
+ /**
2678
+ * 实时飞行追踪器
2679
+ *
2680
+ * 用于接收 WebSocket 推送的实时航点数据,更新飞机位置并绘制飞过的轨迹
2681
+ */
2682
+ declare class RealtimeFlightTracker {
2683
+ private CesiumNS;
2684
+ private viewer;
2685
+ private options;
2686
+ private airplaneCursor?;
2687
+ private trackEntity?;
2688
+ private trackPositions;
2689
+ private isInitialized;
2690
+ constructor(CesiumNS: typeof Cesium, viewer: Cesium.Viewer, options?: RealtimeFlightTrackerOptions);
2691
+ /**
2692
+ * 更新飞机位置(接收新航点)
2693
+ * @param waypoint 实时航点数据
2694
+ */
2695
+ updatePosition(waypoint: RealtimeWaypoint): void;
2696
+ /**
2697
+ * 初始化飞机和轨迹实体
2698
+ */
2699
+ private initialize;
2700
+ /**
2701
+ * 创建轨迹实体
2702
+ */
2703
+ private createTrackEntity;
2704
+ /**
2705
+ * 添加轨迹点
2706
+ */
2707
+ private addTrackPoint;
2708
+ /**
2709
+ * 清除轨迹
2710
+ */
2711
+ clearTrack(): void;
2712
+ /**
2713
+ * 获取当前轨迹点数
2714
+ */
2715
+ getTrackPointCount(): number;
2716
+ /**
2717
+ * 设置轨迹可见性
2718
+ */
2719
+ setTrackVisible(visible: boolean): void;
2720
+ /**
2721
+ * 飞到当前飞机位置
2722
+ */
2723
+ flyToAirplane(options?: {
2724
+ height?: number;
2725
+ duration?: number;
2726
+ }): void;
2727
+ /**
2728
+ * 销毁并清理资源
2729
+ */
2730
+ destroy(): void;
2731
+ }
2732
+
2639
2733
  /**
2640
2734
  * Path 编辑保存结果数据接口
2641
2735
  * 对应 pathEditing.ts 中 saveAndStop() 返回的数据结构
@@ -2864,4 +2958,4 @@ declare const placeholder: {
2864
2958
  };
2865
2959
  declare const droneModelUrl: string;
2866
2960
 
2867
- export { type AltitudeMode, CZMLManager, type CameraDestinationInput, CameraEventBus, type CameraFOVChangeEvent, CameraFOVController, type CameraFlyOptions, type CameraInitOptions, CameraManager, type CameraOrientation, type CameraPoseChangeEvent, type CameraSetViewOptions, type CameraView, type CaptureWithViewOptions, type CesiumAssetsOptions, type ConvertedWaylineData, type ConvertedWaypointData, type CursorPoseChangeEvent, type CzmlExportOptions, type CzmlImportOptions, type EditingChange, Emitter, type FOVChangeEvent, type FOVControllerOptions, type FlightPathPreviewController, FlightSimulator, type FlightSimulatorController, type FlightSimulatorOptions, type FlightSimulatorState, type FlightSimulatorStateChangeEvent, type FlyToBoundsOptions, type FlyToOptions, FrustumPyramid, type FrustumPyramidOptions, type FrustumShapeChangeEvent, type GeoBounds, type GeoPoint, type ImageryOptions, type ImageryProviderKind, type InitOptions, type LayerEvents, type LayerHandle, LayerManager, type LayerType, type Listener, type LoadMapLayersResult, type LoadSliceJsonOptions, type LoadSliceJsonResult, type LonLatHeight, type MapLayerConfig, type Orientation, type PathEditingSaveResult, type PathOptions, type PathSafetyCheckOptions, type PathSafetyCheckResult, PathSafetyChecker, type PathToSinoflyOptions, type PhotoBillboardItem, type PhotoBillboardLayerOptions, type PhotoBillboardResult, type PointCloudPickResult, type PointCloudPickSession, PointCloudPicker, type PointCloudPickerOptions, type PolygonDrawingOptions, type PolygonEditingSession, PolygonEditor, type PreviousViewChange, type QuickEditOptions, type RenderFlightPathOptions, type RenderFlightPathPreviewOptions, SceneManager, type SceneOptions, type ScreenshotOptions, type ScreenshotResult, type SegmentSafetyResult, type SelectionChange, type SelectionResult, type SelectionSession, Selector, type ShapeLineProps, type ShapePointProps, type ShapePolygonProps, type SinoflyAdapterOptions, type SinoflyWaylineData, type SinoflyWaypointInfo, type SliceJsonData, StateManager, type TerrainKind, type TerrainOptions, type Toggle2D3DContext, type Toggle2D3DOptions, type VersionInfo, assertCesiumAssetsConfigured, calculateAbsoluteHeight, calculateBoundsDiagonal, calculateDistance, calculateDistanceAndMidpoint, calculateGeoBounds, calculateHeadingBetweenPoints, calculateMidpoint, calculateRelativeHeight, configureCesiumAssets, configureCesiumIonToken, convertPathToSinofly, convertSinoflyWayline, convertSinoflyWaylines, droneModelUrl, ensureCesiumIonToken, expandBounds, getCesiumBaseUrl, getCesiumIonToken, globalCameraEventBus, globalState, isPointInBounds, mergeBounds, placeholder, queryTerrainHeightAsync, queryTerrainHeightByLonLat, queryTerrainHeightByLonLatSync, queryTerrainHeightSync, queryTerrainHeights, queryTerrainHeightsByLonLat, renderFlightPath, renderFlightPathPreview, toggle2D3D, version, versionInfo };
2961
+ export { type AltitudeMode, CZMLManager, type CameraDestinationInput, CameraEventBus, type CameraFOVChangeEvent, CameraFOVController, type CameraFlyOptions, type CameraInitOptions, CameraManager, type CameraOrientation, type CameraPoseChangeEvent, type CameraSetViewOptions, type CameraView, type CaptureWithViewOptions, type CesiumAssetsOptions, type ConvertedWaylineData, type ConvertedWaypointData, type CursorPoseChangeEvent, type CzmlExportOptions, type CzmlImportOptions, type EditingChange, Emitter, type FOVChangeEvent, type FOVControllerOptions, type FlightPathPreviewController, FlightSimulator, type FlightSimulatorController, type FlightSimulatorOptions, type FlightSimulatorState, type FlightSimulatorStateChangeEvent, type FlyToBoundsOptions, type FlyToOptions, FrustumPyramid, type FrustumPyramidOptions, type FrustumShapeChangeEvent, type GeoBounds, type GeoPoint, type ImageryOptions, type ImageryProviderKind, type InitOptions, type LayerEvents, type LayerHandle, LayerManager, type LayerType, type Listener, type LoadMapLayersResult, type LoadSliceJsonOptions, type LoadSliceJsonResult, type LonLatHeight, type MapLayerConfig, type Orientation, type PathEditingSaveResult, type PathOptions, type PathSafetyCheckOptions, type PathSafetyCheckResult, PathSafetyChecker, type PathToSinoflyOptions, type PhotoBillboardItem, type PhotoBillboardLayerOptions, type PhotoBillboardResult, type PointCloudPickResult, type PointCloudPickSession, PointCloudPicker, type PointCloudPickerOptions, type PolygonDrawingOptions, type PolygonEditingSession, PolygonEditor, type PreviousViewChange, type QuickEditOptions, RealtimeFlightTracker, type RealtimeFlightTrackerOptions, type RealtimeWaypoint, type RenderFlightPathOptions, type RenderFlightPathPreviewOptions, SceneManager, type SceneOptions, type ScreenshotOptions, type ScreenshotResult, type SegmentSafetyResult, type SelectionChange, type SelectionResult, type SelectionSession, Selector, type ShapeLineProps, type ShapePointProps, type ShapePolygonProps, type SinoflyAdapterOptions, type SinoflyWaylineData, type SinoflyWaypointInfo, type SliceJsonData, StateManager, type TerrainKind, type TerrainOptions, type Toggle2D3DContext, type Toggle2D3DOptions, type TrackStyleOptions, type VersionInfo, assertCesiumAssetsConfigured, calculateAbsoluteHeight, calculateBoundsDiagonal, calculateDistance, calculateDistanceAndMidpoint, calculateGeoBounds, calculateHeadingBetweenPoints, calculateMidpoint, calculateRelativeHeight, configureCesiumAssets, configureCesiumIonToken, convertPathToSinofly, convertSinoflyWayline, convertSinoflyWaylines, droneModelUrl, ensureCesiumIonToken, expandBounds, getCesiumBaseUrl, getCesiumIonToken, globalCameraEventBus, globalState, isPointInBounds, mergeBounds, placeholder, queryTerrainHeightAsync, queryTerrainHeightByLonLat, queryTerrainHeightByLonLatSync, queryTerrainHeightSync, queryTerrainHeights, queryTerrainHeightsByLonLat, renderFlightPath, renderFlightPathPreview, toggle2D3D, version, versionInfo };
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
11
11
  // package.json
12
12
  var package_default = {
13
13
  name: "@jorgmoritz/gis-manager",
14
- version: "0.1.43"};
14
+ version: "0.1.44"};
15
15
 
16
16
  // src/utils/version.ts
17
17
  var version = package_default.version;
@@ -3555,6 +3555,8 @@ var AirplaneCursor = class {
3555
3555
  __publicField(this, "cameraChangedListener");
3556
3556
  /** 飞机游标模型可见性,默认 false */
3557
3557
  __publicField(this, "visible", false);
3558
+ /** 是否显示视锥体,默认 true */
3559
+ __publicField(this, "showFrustum", true);
3558
3560
  const C = this.CesiumNS;
3559
3561
  this.opts = opts;
3560
3562
  this.pose = { position: startPosition, heading: 0, pitch: -10, roll: 0 };
@@ -3563,6 +3565,7 @@ var AirplaneCursor = class {
3563
3565
  this.fastFactor = opts.fastFactor ?? 5;
3564
3566
  this.currentFOV = opts.fovDeg ?? DEFAULT_FOV;
3565
3567
  this.visible = opts.visible ?? false;
3568
+ this.showFrustum = opts.showFrustum ?? true;
3566
3569
  this.ensureEntity(opts.color ?? C.Color.CYAN.withAlpha(0.9));
3567
3570
  this.attachKeyboard(opts);
3568
3571
  this.setupFOVListener();
@@ -3796,6 +3799,7 @@ var AirplaneCursor = class {
3796
3799
  * - 后续只依赖回调读取 pose 与 currentFOV 即可自动更新
3797
3800
  */
3798
3801
  updateFrustum() {
3802
+ if (!this.showFrustum) return;
3799
3803
  try {
3800
3804
  if (!this.frustum) {
3801
3805
  let layer = this.viewer.dataSources?._dataSources?.[0];
@@ -12224,6 +12228,171 @@ var PointCloudPicker = class {
12224
12228
  }
12225
12229
  };
12226
12230
 
12231
+ // src/core/path-manager/RealtimeFlightTracker.ts
12232
+ var RealtimeFlightTracker = class {
12233
+ constructor(CesiumNS, viewer, options) {
12234
+ __publicField(this, "CesiumNS");
12235
+ __publicField(this, "viewer");
12236
+ __publicField(this, "options");
12237
+ __publicField(this, "airplaneCursor");
12238
+ __publicField(this, "trackEntity");
12239
+ __publicField(this, "trackPositions", []);
12240
+ __publicField(this, "isInitialized", false);
12241
+ this.CesiumNS = CesiumNS;
12242
+ this.viewer = viewer;
12243
+ const C = CesiumNS;
12244
+ this.options = {
12245
+ showTrack: options?.showTrack ?? true,
12246
+ fovDeg: options?.fovDeg ?? 50,
12247
+ layer: options?.layer,
12248
+ trackStyle: {
12249
+ color: options?.trackStyle?.color ?? C.Color.CYAN,
12250
+ width: options?.trackStyle?.width ?? 3,
12251
+ clampToGround: options?.trackStyle?.clampToGround ?? false,
12252
+ maxPoints: options?.trackStyle?.maxPoints ?? 1e3
12253
+ }
12254
+ };
12255
+ }
12256
+ /**
12257
+ * 更新飞机位置(接收新航点)
12258
+ * @param waypoint 实时航点数据
12259
+ */
12260
+ updatePosition(waypoint) {
12261
+ const C = this.CesiumNS;
12262
+ const position = C.Cartesian3.fromDegrees(
12263
+ waypoint.longitude,
12264
+ waypoint.latitude,
12265
+ waypoint.altitude
12266
+ );
12267
+ if (!this.isInitialized) {
12268
+ this.initialize(position);
12269
+ this.isInitialized = true;
12270
+ }
12271
+ if (this.airplaneCursor) {
12272
+ this.airplaneCursor.setPose(
12273
+ position,
12274
+ waypoint.heading ?? 0,
12275
+ waypoint.pitch ?? 0,
12276
+ waypoint.roll ?? 0
12277
+ );
12278
+ }
12279
+ if (this.options.showTrack) {
12280
+ this.addTrackPoint(position);
12281
+ }
12282
+ this.viewer.scene.requestRender();
12283
+ }
12284
+ /**
12285
+ * 初始化飞机和轨迹实体
12286
+ */
12287
+ initialize(initialPosition) {
12288
+ this.airplaneCursor = new AirplaneCursor(
12289
+ this.CesiumNS,
12290
+ this.viewer,
12291
+ initialPosition,
12292
+ {
12293
+ stepMeters: 0,
12294
+ // 禁用键盘控制
12295
+ angleStepDeg: 0,
12296
+ fovDeg: this.options.fovDeg,
12297
+ visible: true,
12298
+ showFrustum: false
12299
+ // 实时飞行追踪不显示视锥体
12300
+ }
12301
+ );
12302
+ if (this.options.showTrack) {
12303
+ this.createTrackEntity();
12304
+ }
12305
+ }
12306
+ /**
12307
+ * 创建轨迹实体
12308
+ */
12309
+ createTrackEntity() {
12310
+ const C = this.CesiumNS;
12311
+ const entities = this.options.layer?.entities ?? this.viewer.entities;
12312
+ const style = this.options.trackStyle;
12313
+ this.trackEntity = entities.add({
12314
+ id: `realtime-flight-track-${Date.now()}`,
12315
+ polyline: {
12316
+ // 使用 CallbackProperty 实现动态更新
12317
+ positions: new C.CallbackProperty(() => {
12318
+ return this.trackPositions.slice();
12319
+ }, false),
12320
+ width: style.width,
12321
+ material: style.color,
12322
+ clampToGround: style.clampToGround
12323
+ },
12324
+ properties: {
12325
+ _type: "realtime-flight-track"
12326
+ }
12327
+ });
12328
+ }
12329
+ /**
12330
+ * 添加轨迹点
12331
+ */
12332
+ addTrackPoint(position) {
12333
+ this.trackPositions.push(position);
12334
+ const maxPoints = this.options.trackStyle.maxPoints;
12335
+ if (this.trackPositions.length > maxPoints) {
12336
+ this.trackPositions = this.trackPositions.slice(-maxPoints);
12337
+ }
12338
+ }
12339
+ /**
12340
+ * 清除轨迹
12341
+ */
12342
+ clearTrack() {
12343
+ this.trackPositions = [];
12344
+ this.viewer.scene.requestRender();
12345
+ }
12346
+ /**
12347
+ * 获取当前轨迹点数
12348
+ */
12349
+ getTrackPointCount() {
12350
+ return this.trackPositions.length;
12351
+ }
12352
+ /**
12353
+ * 设置轨迹可见性
12354
+ */
12355
+ setTrackVisible(visible) {
12356
+ if (this.trackEntity) {
12357
+ this.trackEntity.show = visible;
12358
+ this.viewer.scene.requestRender();
12359
+ }
12360
+ }
12361
+ /**
12362
+ * 飞到当前飞机位置
12363
+ */
12364
+ flyToAirplane(options) {
12365
+ if (this.trackPositions.length === 0) return;
12366
+ const C = this.CesiumNS;
12367
+ const lastPosition = this.trackPositions[this.trackPositions.length - 1];
12368
+ const carto = C.Cartographic.fromCartesian(lastPosition);
12369
+ this.viewer.camera.flyTo({
12370
+ destination: C.Cartesian3.fromRadians(
12371
+ carto.longitude,
12372
+ carto.latitude,
12373
+ (options?.height ?? 500) + carto.height
12374
+ ),
12375
+ duration: options?.duration ?? 1.5
12376
+ });
12377
+ }
12378
+ /**
12379
+ * 销毁并清理资源
12380
+ */
12381
+ destroy() {
12382
+ const entities = this.options.layer?.entities ?? this.viewer.entities;
12383
+ if (this.airplaneCursor) {
12384
+ this.airplaneCursor.destroy();
12385
+ this.airplaneCursor = void 0;
12386
+ }
12387
+ if (this.trackEntity) {
12388
+ entities.remove(this.trackEntity);
12389
+ this.trackEntity = void 0;
12390
+ }
12391
+ this.trackPositions = [];
12392
+ this.isInitialized = false;
12393
+ }
12394
+ };
12395
+
12227
12396
  // src/utils/pathToSinoflyAdapter.ts
12228
12397
  function convertCartesian3ToLatLonHeight(CesiumNS, position) {
12229
12398
  const C = CesiumNS;
@@ -12792,6 +12961,6 @@ var PathSafetyChecker = class {
12792
12961
  var placeholder = { ready: true };
12793
12962
  var droneModelUrl = wurenji_default;
12794
12963
 
12795
- export { CZMLManager, CameraEventBus, CameraFOVController, CameraManager, Emitter, FlightSimulator, FrustumPyramid, LayerManager, PathSafetyChecker, PointCloudPicker, PolygonEditor, SceneManager, Selector, StateManager, assertCesiumAssetsConfigured, calculateAbsoluteHeight, calculateBoundsDiagonal, calculateDistance, calculateDistanceAndMidpoint, calculateGeoBounds, calculateHeadingBetweenPoints, calculateMidpoint, calculateRelativeHeight, configureCesiumAssets, configureCesiumIonToken, convertPathToSinofly, convertSinoflyWayline, convertSinoflyWaylines, droneModelUrl, ensureCesiumIonToken, expandBounds, getCesiumBaseUrl, getCesiumIonToken, globalCameraEventBus, globalState, isPointInBounds, mergeBounds, placeholder, queryTerrainHeightAsync, queryTerrainHeightByLonLat, queryTerrainHeightByLonLatSync, queryTerrainHeightSync, queryTerrainHeights, queryTerrainHeightsByLonLat, renderFlightPath, renderFlightPathPreview, toggle2D3D, version, versionInfo };
12964
+ export { CZMLManager, CameraEventBus, CameraFOVController, CameraManager, Emitter, FlightSimulator, FrustumPyramid, LayerManager, PathSafetyChecker, PointCloudPicker, PolygonEditor, RealtimeFlightTracker, SceneManager, Selector, StateManager, assertCesiumAssetsConfigured, calculateAbsoluteHeight, calculateBoundsDiagonal, calculateDistance, calculateDistanceAndMidpoint, calculateGeoBounds, calculateHeadingBetweenPoints, calculateMidpoint, calculateRelativeHeight, configureCesiumAssets, configureCesiumIonToken, convertPathToSinofly, convertSinoflyWayline, convertSinoflyWaylines, droneModelUrl, ensureCesiumIonToken, expandBounds, getCesiumBaseUrl, getCesiumIonToken, globalCameraEventBus, globalState, isPointInBounds, mergeBounds, placeholder, queryTerrainHeightAsync, queryTerrainHeightByLonLat, queryTerrainHeightByLonLatSync, queryTerrainHeightSync, queryTerrainHeights, queryTerrainHeightsByLonLat, renderFlightPath, renderFlightPathPreview, toggle2D3D, version, versionInfo };
12796
12965
  //# sourceMappingURL=index.js.map
12797
12966
  //# sourceMappingURL=index.js.map