@jorgmoritz/gis-manager 0.1.28 → 0.1.30

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.ts CHANGED
@@ -635,6 +635,7 @@ declare function convertSinoflyWaylines(dataList: SinoflyWaylineData[], options:
635
635
  waylineId?: number | string;
636
636
  }>;
637
637
 
638
+ type Entity$1 = Cesium.Entity;
638
639
  /**
639
640
  * 回显飞航路线的选项类型
640
641
  */
@@ -656,6 +657,278 @@ interface RenderFlightPathOptions {
656
657
  altitudeMode?: string;
657
658
  climbHeight?: number;
658
659
  }
660
+ /**
661
+ * 回显飞航路线:显示完整飞航路线、航点编号和起始点箭头
662
+ *
663
+ * 接收 Sinofly 航线路数据,自动转换为本库格式并渲染显示。
664
+ *
665
+ * 航点逻辑说明:
666
+ * - index 0: 起始点(起飞点),显示起始箭头(仅当有 takeOffRefPoint 时)
667
+ * - index 1: 隐藏转折点(隐藏爬升点),不显示标签(仅当有 takeOffRefPoint 时)
668
+ * - index 2: 第一个航线点,标记为 "S"
669
+ * - index 3+: 后续航线点,标记为 2, 3, 4...
670
+ *
671
+ * 如果没有 takeOffRefPoint,则:
672
+ * - index 0: 第一个航线点,标记为 "S"
673
+ * - index 1+: 后续航线点,标记为 2, 3, 4...
674
+ *
675
+ * @param CesiumNS Cesium 命名空间
676
+ * @param viewer Cesium Viewer 实例
677
+ * @param options 回显选项,包含 Sinofly 数据和配置
678
+ * @returns 创建的 polyline 实体
679
+ *
680
+ * @example
681
+ * ```typescript
682
+ * // 基本用法
683
+ * const sinoflyData = {
684
+ * waylineId: "12345",
685
+ * waylineName: "测试航线",
686
+ * takeOffSecurityHeight: 50,
687
+ * takeOffRefPoint: '{"longitude": 116.4074, "latitude": 39.9042, "height": 100}',
688
+ * waypointInfo: [
689
+ * {
690
+ * index: 0,
691
+ * latitude: "39.9045",
692
+ * longitude: "116.4078",
693
+ * altitude: "150.0",
694
+ * action: '[{"rotateYaw": {"aircraftHeading": 45}, "gimbalRotate": {"gimbalPitchRotateAngle": -10}}]'
695
+ * },
696
+ * // ... 更多航点
697
+ * ]
698
+ * };
699
+ *
700
+ * const entity = renderFlightPath(Cesium, viewer, {
701
+ * data: sinoflyData,
702
+ * adapterOptions: {
703
+ * parseActionForPose: true,
704
+ * defaultHeading: 0,
705
+ * defaultPitch: -10
706
+ * },
707
+ * layer: myLayer,
708
+ * style: { width: 8, color: Cesium.Color.GREEN }
709
+ * });
710
+ *
711
+ * // 自定义样式
712
+ * const entity = renderFlightPath(Cesium, viewer, {
713
+ * data: sinoflyData,
714
+ * id: 'my-flight-path',
715
+ * name: '自定义航线名称',
716
+ * style: {
717
+ * width: 10,
718
+ * material: new Cesium.PolylineOutlineMaterialProperty({
719
+ * color: Cesium.Color.BLUE,
720
+ * outlineColor: Cesium.Color.WHITE,
721
+ * outlineWidth: 2
722
+ * })
723
+ * }
724
+ * });
725
+ * ```
726
+ */
727
+ declare function renderFlightPath(CesiumNS: typeof Cesium, viewer: Cesium.Viewer, options: RenderFlightPathOptions): Entity$1;
728
+ /**
729
+ * 预览模式渲染选项(扩展基础选项)
730
+ */
731
+ interface RenderFlightPathPreviewOptions extends RenderFlightPathOptions {
732
+ /** 航点点击回调 */
733
+ onWaypointClick?: (index: number, waypointData: any) => void;
734
+ /** 初始选中的航点索引 */
735
+ initialSelectedIndex?: number;
736
+ }
737
+ /**
738
+ * 预览模式控制器接口
739
+ */
740
+ interface FlightPathPreviewController {
741
+ /** 设置选中的航点(高亮显示)*/
742
+ setSelectedWaypoint: (index: number | null) => void;
743
+ /** 获取当前选中的航点索引 */
744
+ getSelectedWaypoint: () => number | null;
745
+ /** 销毁控制器(移除事件监听等)*/
746
+ destroy: () => void;
747
+ }
748
+ /**
749
+ * 预览模式渲染飞航路线:支持航点点击高亮
750
+ *
751
+ * 与 renderFlightPath 不同,此函数返回一个控制器对象,支持:
752
+ * - 航点点击事件回调
753
+ * - 程序化设置选中航点(高亮显示)
754
+ * - 列表与地图双向联动
755
+ *
756
+ * @param CesiumNS Cesium 命名空间
757
+ * @param viewer Cesium Viewer 实例
758
+ * @param options 预览选项
759
+ * @returns 包含实体和控制器的对象
760
+ *
761
+ * @example
762
+ * ```typescript
763
+ * const { entity, controller } = renderFlightPathPreview(Cesium, viewer, {
764
+ * data: sinoflyData,
765
+ * onWaypointClick: (index, waypoint) => {
766
+ * console.log('点击了航点', index, waypoint);
767
+ * },
768
+ * initialSelectedIndex: 0
769
+ * });
770
+ *
771
+ * // 程序化设置选中航点
772
+ * controller.setSelectedWaypoint(2);
773
+ *
774
+ * // 销毁
775
+ * controller.destroy();
776
+ * ```
777
+ */
778
+ declare function renderFlightPathPreview(CesiumNS: typeof Cesium, viewer: Cesium.Viewer, options: RenderFlightPathPreviewOptions): {
779
+ entity: Entity$1;
780
+ controller: FlightPathPreviewController;
781
+ };
782
+
783
+ /**
784
+ * 飞行预览控制器
785
+ *
786
+ * 功能:
787
+ * - 飞机沿航线飞行动画(循环播放)
788
+ * - 第一人称镜头预览窗口
789
+ * - 轨迹高亮(已飞过/未飞过航段)
790
+ * - 预览模式下禁用交互
791
+ */
792
+
793
+ /** 播放状态 */
794
+ type FlightPreviewState = 'playing' | 'paused' | 'stopped';
795
+ /** 轨迹高亮配置 */
796
+ interface TrackHighlightOptions {
797
+ /** 是否启用,默认 true */
798
+ enabled?: boolean;
799
+ /** 已飞过航段颜色 */
800
+ traveledColor?: Cesium.Color;
801
+ /** 未飞过航段颜色 */
802
+ remainingColor?: Cesium.Color;
803
+ /** 已飞过航段宽度 */
804
+ traveledWidth?: number;
805
+ /** 未飞过航段宽度 */
806
+ remainingWidth?: number;
807
+ }
808
+ /** 飞行预览选项 */
809
+ interface FlightPreviewOptions {
810
+ /** 航线数据 */
811
+ waylineData: SinoflyWaylineData;
812
+ /** 飞行速度 (m/s),默认 10 */
813
+ speed?: number;
814
+ /** 是否循环播放,默认 true */
815
+ loop?: boolean;
816
+ /** 预览窗口容器 */
817
+ previewContainer?: HTMLElement;
818
+ /** 是否显示视锥体,默认 true */
819
+ showFrustum?: boolean;
820
+ /** 轨迹高亮配置 */
821
+ trackHighlight?: TrackHighlightOptions;
822
+ /** 数据源图层 */
823
+ layer?: Cesium.CustomDataSource;
824
+ }
825
+ /** 进度变化事件 */
826
+ interface ProgressChangeEvent {
827
+ /** 当前进度 (0-1) */
828
+ progress: number;
829
+ /** 当前位置 */
830
+ position: Cesium.Cartesian3;
831
+ /** 当前航点索引 */
832
+ waypointIndex: number;
833
+ /** 当前姿态 */
834
+ pose: {
835
+ heading: number;
836
+ pitch: number;
837
+ roll: number;
838
+ };
839
+ }
840
+ /** 状态变化事件 */
841
+ interface StateChangeEvent {
842
+ state: FlightPreviewState;
843
+ }
844
+ /**
845
+ * 飞行预览控制器
846
+ */
847
+ declare class FlightPreviewController {
848
+ private CesiumNS;
849
+ private viewer;
850
+ private options;
851
+ private state;
852
+ private destroyed;
853
+ private speed;
854
+ private loop;
855
+ private showFrustum;
856
+ private trackHighlightOptions;
857
+ private waypoints;
858
+ private totalDistance;
859
+ private currentDistance;
860
+ private animationFrameId?;
861
+ private lastFrameTime?;
862
+ private layer?;
863
+ private droneEntity?;
864
+ private frustum?;
865
+ private pathPreview?;
866
+ private traveledPathEntity?;
867
+ private remainingPathEntity?;
868
+ onStateChange: Emitter<StateChangeEvent>;
869
+ onProgressChange: Emitter<ProgressChangeEvent>;
870
+ constructor(CesiumNS: typeof Cesium, viewer: Cesium.Viewer, options: FlightPreviewOptions);
871
+ /** 开始预览 */
872
+ start(): void;
873
+ /** 暂停 */
874
+ pause(): void;
875
+ /** 继续 */
876
+ resume(): void;
877
+ /** 停止并重置 */
878
+ stop(): void;
879
+ /** 跳转到指定进度 (0-1) */
880
+ seek(progress: number): void;
881
+ /** 设置速度 */
882
+ setSpeed(speed: number): void;
883
+ /** 获取当前状态 */
884
+ getState(): FlightPreviewState;
885
+ /** 获取当前进度 (0-1) */
886
+ getProgress(): number;
887
+ /** 获取当前航点索引 */
888
+ getCurrentWaypointIndex(): number;
889
+ /** 销毁 */
890
+ destroy(): void;
891
+ /** 初始化图层 */
892
+ private initLayer;
893
+ /** 解析航线数据 */
894
+ private parseWaylineData;
895
+ /** 初始化可视化组件 */
896
+ private initVisualization;
897
+ /** 初始化无人机模型 */
898
+ private initDroneModel;
899
+ /** 应用模型偏移 */
900
+ private applyModelOffset;
901
+ /** 初始化视锥体 */
902
+ private initFrustum;
903
+ /** 初始化轨迹高亮 */
904
+ private initTrackHighlight;
905
+ /** 初始化预览窗口 */
906
+ private initPathPreview;
907
+ /** 启动动画循环 */
908
+ private startAnimationLoop;
909
+ /** 停止动画循环 */
910
+ private stopAnimationLoop;
911
+ /** 查找当前所在航段 */
912
+ private findCurrentSegment;
913
+ /** 获取当前姿态 */
914
+ private getCurrentPose;
915
+ /** 位置插值 */
916
+ private interpolatePosition;
917
+ /** 角度插值(处理 0-360 环绕) */
918
+ private interpolateAngle;
919
+ /** 线性插值 */
920
+ private lerp;
921
+ /** 获取已飞过的位置数组 */
922
+ private getTraveledPositions;
923
+ /** 获取未飞过的位置数组 */
924
+ private getRemainingPositions;
925
+ /** 更新可视化 */
926
+ private updateVisualization;
927
+ /** 设置状态 */
928
+ private setState;
929
+ /** 销毁可视化组件 */
930
+ private destroyVisualization;
931
+ }
659
932
 
660
933
  type PathSample = {
661
934
  time: Cesium.JulianDate | Date | string | number;
@@ -741,6 +1014,21 @@ declare class CZMLManager {
741
1014
  * ```
742
1015
  */
743
1016
  renderFlightPath(options: RenderFlightPathOptions): Entity;
1017
+ /**
1018
+ * 预览模式渲染飞航路线:支持航点点击高亮
1019
+ *
1020
+ * 与 renderFlightPath 不同,此方法返回一个控制器对象,支持:
1021
+ * - 航点点击事件回调
1022
+ * - 程序化设置选中航点(高亮显示)
1023
+ * - 列表与地图双向联动
1024
+ *
1025
+ * @param options 预览选项
1026
+ * @returns 包含实体和控制器的对象
1027
+ */
1028
+ renderFlightPathPreview(options: RenderFlightPathPreviewOptions): {
1029
+ entity: Entity;
1030
+ controller: FlightPathPreviewController;
1031
+ };
744
1032
  addPathSample(entityOrId: Entity | string, sample: PathSample): void;
745
1033
  addPathSamples(entityOrId: Entity | string, samples: PathSample[]): void;
746
1034
  setPathSamples(entityOrId: Entity | string, samples: PathSample[]): void;
@@ -1500,20 +1788,26 @@ interface PreviousViewChange {
1500
1788
  current?: CameraView;
1501
1789
  previous?: CameraView;
1502
1790
  }
1791
+ interface FlightPreviewChange {
1792
+ previewing: boolean;
1793
+ }
1503
1794
  /**
1504
1795
  * Lightweight state manager for common UI states:
1505
1796
  * - selection (arbitrary payload)
1506
1797
  * - editing (boolean + optional target)
1507
1798
  * - previous camera view (for simple back navigation)
1799
+ * - flight preview mode (locks interaction)
1508
1800
  */
1509
1801
  declare class StateManager<TSelection = unknown, TEditingTarget = unknown> {
1510
1802
  private selected?;
1511
1803
  private editing;
1512
1804
  private editingTarget?;
1513
1805
  private previousView?;
1806
+ private flightPreviewing;
1514
1807
  readonly onSelectionChange: Emitter<SelectionChange<TSelection>>;
1515
1808
  readonly onEditingChange: Emitter<EditingChange<TEditingTarget>>;
1516
1809
  readonly onPreviousViewChange: Emitter<PreviousViewChange>;
1810
+ readonly onFlightPreviewChange: Emitter<FlightPreviewChange>;
1517
1811
  setSelected(next?: TSelection): void;
1518
1812
  /**
1519
1813
  * 获取当前选中对象。
@@ -1530,6 +1824,22 @@ declare class StateManager<TSelection = unknown, TEditingTarget = unknown> {
1530
1824
  getEditingTarget(): TEditingTarget | undefined;
1531
1825
  setPreviousCameraView(view?: CameraView): void;
1532
1826
  getPreviousCameraView(): CameraView | undefined;
1827
+ /**
1828
+ * 开始飞行预览模式(锁定交互)
1829
+ */
1830
+ startFlightPreview(): void;
1831
+ /**
1832
+ * 停止飞行预览模式(恢复交互)
1833
+ */
1834
+ stopFlightPreview(): void;
1835
+ /**
1836
+ * 检查是否处于飞行预览模式
1837
+ */
1838
+ isFlightPreviewing(): boolean;
1839
+ /**
1840
+ * 检查当前是否允许交互(非编辑模式且非飞行预览模式)
1841
+ */
1842
+ isInteractionAllowed(): boolean;
1533
1843
  }
1534
1844
  declare const globalState: StateManager<any, any>;
1535
1845
 
@@ -1912,4 +2222,4 @@ declare const placeholder: {
1912
2222
  ready: boolean;
1913
2223
  };
1914
2224
 
1915
- export { CZMLManager, type CameraDestinationInput, CameraEventBus, type CameraFOVChangeEvent, CameraFOVController, type CameraFlyOptions, type CameraInitOptions, CameraManager, type CameraOrientation, type CameraPoseChangeEvent, type CameraSetViewOptions, type CameraView, type CesiumAssetsOptions, type ConvertedWaylineData, type ConvertedWaypointData, type CursorPoseChangeEvent, type CzmlExportOptions, type CzmlImportOptions, type EditingChange, Emitter, type FOVChangeEvent, type FOVControllerOptions, type FlyToOptions, FrustumPyramid, type FrustumPyramidOptions, type FrustumShapeChangeEvent, type ImageryOptions, type ImageryProviderKind, type InitOptions, type LayerEvents, type LayerHandle, LayerManager, type LayerType, type Listener, type LonLatHeight, type Orientation, type PathEditingSaveResult, type PathOptions, type PathToSinoflyOptions, type PhotoBillboardItem, type PhotoBillboardLayerOptions, type PhotoBillboardResult, type PolygonDrawingOptions, type PolygonEditingSession, PolygonEditor, type PreviousViewChange, type QuickEditOptions, SceneManager, type SceneOptions, type SelectionChange, type SelectionResult, type SelectionSession, Selector, type ShapeLineProps, type ShapePointProps, type ShapePolygonProps, type SinoflyAdapterOptions, type SinoflyWaylineData, type SinoflyWaypointInfo, StateManager, type TerrainKind, type TerrainOptions, type Toggle2D3DContext, type Toggle2D3DOptions, type VersionInfo, assertCesiumAssetsConfigured, configureCesiumAssets, configureCesiumIonToken, convertPathToSinofly, convertSinoflyWayline, convertSinoflyWaylines, ensureCesiumIonToken, getCesiumBaseUrl, getCesiumIonToken, globalCameraEventBus, globalState, placeholder, toggle2D3D, version, versionInfo };
2225
+ export { CZMLManager, type CameraDestinationInput, CameraEventBus, type CameraFOVChangeEvent, CameraFOVController, type CameraFlyOptions, type CameraInitOptions, CameraManager, type CameraOrientation, type CameraPoseChangeEvent, type CameraSetViewOptions, type CameraView, type CesiumAssetsOptions, type ConvertedWaylineData, type ConvertedWaypointData, type CursorPoseChangeEvent, type CzmlExportOptions, type CzmlImportOptions, type EditingChange, Emitter, type FOVChangeEvent, type FOVControllerOptions, type FlightPathPreviewController, type FlightPreviewChange, FlightPreviewController, type FlightPreviewOptions, type FlightPreviewState, type FlyToOptions, FrustumPyramid, type FrustumPyramidOptions, type FrustumShapeChangeEvent, type ImageryOptions, type ImageryProviderKind, type InitOptions, type LayerEvents, type LayerHandle, LayerManager, type LayerType, type Listener, type LonLatHeight, type Orientation, type PathEditingSaveResult, type PathOptions, type PathToSinoflyOptions, type PhotoBillboardItem, type PhotoBillboardLayerOptions, type PhotoBillboardResult, type PolygonDrawingOptions, type PolygonEditingSession, PolygonEditor, type PreviousViewChange, type ProgressChangeEvent, type QuickEditOptions, type RenderFlightPathOptions, type RenderFlightPathPreviewOptions, SceneManager, type SceneOptions, type SelectionChange, type SelectionResult, type SelectionSession, Selector, type ShapeLineProps, type ShapePointProps, type ShapePolygonProps, type SinoflyAdapterOptions, type SinoflyWaylineData, type SinoflyWaypointInfo, type StateChangeEvent, StateManager, type TerrainKind, type TerrainOptions, type Toggle2D3DContext, type Toggle2D3DOptions, type TrackHighlightOptions, type VersionInfo, assertCesiumAssetsConfigured, configureCesiumAssets, configureCesiumIonToken, convertPathToSinofly, convertSinoflyWayline, convertSinoflyWaylines, ensureCesiumIonToken, getCesiumBaseUrl, getCesiumIonToken, globalCameraEventBus, globalState, placeholder, renderFlightPath, renderFlightPathPreview, toggle2D3D, version, versionInfo };