@jorgmoritz/gis-manager 0.1.49 → 0.1.51

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
@@ -698,6 +698,506 @@ declare class CameraManager {
698
698
  private waitForAnimationFrame;
699
699
  }
700
700
 
701
+ /**
702
+ * 地形管理器类型定义
703
+ */
704
+ /** 地形源类型 */
705
+ type TerrainSourceType = 'global' | 'local';
706
+ /** 地形提供者类型 */
707
+ type TerrainProviderType = 'cesium-ion' | 'url' | 'ellipsoid';
708
+ /** 地形源配置 */
709
+ interface TerrainSourceConfig {
710
+ /** 唯一标识 */
711
+ id: string;
712
+ /** 地形源类型:global=全局地形, local=局部地形 */
713
+ type: TerrainSourceType;
714
+ /** 地形提供者类型 */
715
+ providerType: TerrainProviderType;
716
+ /** 地形数据 URL(providerType 为 'url' 时必填) */
717
+ url?: string;
718
+ /** Cesium Ion Asset ID(providerType 为 'cesium-ion' 时使用) */
719
+ ionAssetId?: number;
720
+ /** 局部地形的覆盖范围 [west, south, east, north],单位:度 */
721
+ bounds?: [number, number, number, number];
722
+ /** 优先级,数值越大优先级越高,默认 0 */
723
+ priority?: number;
724
+ /** 缩放级别范围 */
725
+ zoomRange?: {
726
+ min?: number;
727
+ max?: number;
728
+ };
729
+ /** 是否请求顶点法线 */
730
+ requestVertexNormals?: boolean;
731
+ /** 是否请求水面遮罩 */
732
+ requestWaterMask?: boolean;
733
+ }
734
+ /** 地形切换选项 */
735
+ interface TerrainSwitchOptions {
736
+ /** 切换后是否飞行到目标区域(仅对局部地形有效) */
737
+ flyTo?: boolean;
738
+ /** 飞行时长(秒),默认 2 */
739
+ flyDuration?: number;
740
+ }
741
+ /** 地形切换结果 */
742
+ interface TerrainSwitchResult {
743
+ /** 是否成功 */
744
+ success: boolean;
745
+ /** 当前激活的地形源 ID */
746
+ activeId: string | null;
747
+ /** 错误信息 */
748
+ error?: string;
749
+ }
750
+ /** 地形管理器事件 */
751
+ interface TerrainManagerEvents {
752
+ /** 地形源已注册 */
753
+ registered: {
754
+ config: TerrainSourceConfig;
755
+ };
756
+ /** 地形源已移除 */
757
+ removed: {
758
+ id: string;
759
+ };
760
+ /** 地形已切换 */
761
+ switched: {
762
+ fromId: string | null;
763
+ toId: string | null;
764
+ };
765
+ /** 发生错误 */
766
+ error: {
767
+ id?: string;
768
+ error: unknown;
769
+ };
770
+ }
771
+
772
+ /**
773
+ * 地形管理器
774
+ * 统一管理地形源的注册、切换和生命周期
775
+ */
776
+
777
+ declare class TerrainManager {
778
+ private CesiumNS;
779
+ private viewer;
780
+ /** 已注册的地形源 */
781
+ private sources;
782
+ /** 当前激活的地形源 ID */
783
+ private activeSourceId;
784
+ /** 事件发射器 */
785
+ events: Emitter<TerrainManagerEvents>;
786
+ constructor(CesiumNS: typeof Cesium, viewer: Cesium.Viewer);
787
+ /**
788
+ * 注册地形源
789
+ * @param config 地形源配置
790
+ */
791
+ register(config: TerrainSourceConfig): void;
792
+ /**
793
+ * 批量注册地形源
794
+ * @param configs 地形源配置数组
795
+ */
796
+ registerBatch(configs: TerrainSourceConfig[]): void;
797
+ /**
798
+ * 切换到指定地形源
799
+ * @param sourceId 地形源 ID
800
+ * @param options 切换选项
801
+ */
802
+ switchTo(sourceId: string, options?: TerrainSwitchOptions): Promise<TerrainSwitchResult>;
803
+ /**
804
+ * 获取当前激活的地形源配置
805
+ */
806
+ getActive(): TerrainSourceConfig | null;
807
+ /**
808
+ * 获取当前激活的地形源 ID
809
+ */
810
+ getActiveId(): string | null;
811
+ /**
812
+ * 获取指定地形源配置
813
+ * @param sourceId 地形源 ID
814
+ */
815
+ get(sourceId: string): TerrainSourceConfig | undefined;
816
+ /**
817
+ * 获取所有已注册的地形源
818
+ */
819
+ list(): TerrainSourceConfig[];
820
+ /**
821
+ * 检查地形源是否已注册
822
+ * @param sourceId 地形源 ID
823
+ */
824
+ has(sourceId: string): boolean;
825
+ /**
826
+ * 移除地形源
827
+ * @param sourceId 地形源 ID
828
+ */
829
+ remove(sourceId: string): boolean;
830
+ /**
831
+ * 重置为椭球体(无地形)
832
+ */
833
+ reset(): void;
834
+ /**
835
+ * 清除所有已注册的地形源
836
+ */
837
+ clear(): void;
838
+ /**
839
+ * 销毁管理器
840
+ */
841
+ destroy(): void;
842
+ /**
843
+ * 创建地形提供者
844
+ */
845
+ private createTerrainProvider;
846
+ /**
847
+ * 飞行到指定范围
848
+ */
849
+ private flyToBounds;
850
+ }
851
+
852
+ /**
853
+ * 影像管理器类型定义
854
+ */
855
+ /** 影像提供者类型 */
856
+ type ImageryProviderType = 'urlTemplate' | 'wmts' | 'wms' | 'arcgis' | 'tms';
857
+ /** 影像图层类型 */
858
+ type ImageryLayerType = 'base' | 'overlay';
859
+ /** 影像图层配置 */
860
+ interface ImageryLayerConfig {
861
+ /** 唯一标识 */
862
+ id: string;
863
+ /** 影像数据 URL */
864
+ url: string;
865
+ /** 影像提供者类型 */
866
+ provider: ImageryProviderType;
867
+ /** 图层类型:base=底图, overlay=叠加层 */
868
+ layerType: ImageryLayerType;
869
+ /** 覆盖范围 [west, south, east, north],单位:度 */
870
+ bounds?: [number, number, number, number];
871
+ /** 透明度 0-1,默认 1 */
872
+ opacity?: number;
873
+ /** 层级顺序,数值越大越靠上,默认 0 */
874
+ zIndex?: number;
875
+ /** 缩放级别范围 */
876
+ zoomRange?: {
877
+ min?: number;
878
+ max?: number;
879
+ };
880
+ /** 是否默认显示,默认 true */
881
+ show?: boolean;
882
+ /** WMTS 特定配置 */
883
+ wmts?: {
884
+ layer: string;
885
+ style?: string;
886
+ tileMatrixSetID: string;
887
+ format?: string;
888
+ };
889
+ /** WMS 特定配置 */
890
+ wms?: {
891
+ layers: string;
892
+ parameters?: Record<string, string>;
893
+ };
894
+ /** 子域名列表(用于负载均衡) */
895
+ subdomains?: string[];
896
+ /** 自定义元数据 */
897
+ metadata?: Record<string, unknown>;
898
+ }
899
+ /** 影像加载选项 */
900
+ interface ImageryLoadOptions {
901
+ /** 加载后是否飞行到目标区域 */
902
+ flyTo?: boolean;
903
+ /** 飞行时长(秒),默认 2 */
904
+ flyDuration?: number;
905
+ }
906
+ /** 影像加载结果 */
907
+ interface ImageryLoadResult {
908
+ /** 图层 ID */
909
+ id: string;
910
+ /** 是否成功 */
911
+ success: boolean;
912
+ /** 错误信息 */
913
+ error?: string;
914
+ }
915
+ /** 影像管理器事件 */
916
+ interface ImageryManagerEvents {
917
+ /** 图层已添加 */
918
+ added: {
919
+ config: ImageryLayerConfig;
920
+ };
921
+ /** 图层已移除 */
922
+ removed: {
923
+ id: string;
924
+ };
925
+ /** 图层可见性变更 */
926
+ visibilityChanged: {
927
+ id: string;
928
+ visible: boolean;
929
+ };
930
+ /** 图层透明度变更 */
931
+ opacityChanged: {
932
+ id: string;
933
+ opacity: number;
934
+ };
935
+ /** 图层顺序变更 */
936
+ orderChanged: {
937
+ id: string;
938
+ zIndex: number;
939
+ };
940
+ /** 发生错误 */
941
+ error: {
942
+ id?: string;
943
+ error: unknown;
944
+ };
945
+ }
946
+
947
+ /**
948
+ * 影像管理器
949
+ * 统一管理影像图层的加载、叠加和生命周期
950
+ */
951
+
952
+ declare class ImageryManager {
953
+ private CesiumNS;
954
+ private viewer;
955
+ /** 已加载的图层 */
956
+ private layers;
957
+ /** 事件发射器 */
958
+ events: Emitter<ImageryManagerEvents>;
959
+ constructor(CesiumNS: typeof Cesium, viewer: Cesium.Viewer);
960
+ /**
961
+ * 添加影像图层
962
+ * @param config 图层配置
963
+ * @param options 加载选项
964
+ */
965
+ add(config: ImageryLayerConfig, options?: ImageryLoadOptions): Promise<ImageryLoadResult>;
966
+ /**
967
+ * 批量添加影像图层
968
+ * @param configs 图层配置数组
969
+ * @param options 加载选项
970
+ */
971
+ addBatch(configs: ImageryLayerConfig[], options?: ImageryLoadOptions): Promise<ImageryLoadResult[]>;
972
+ /**
973
+ * 移除影像图层
974
+ * @param layerId 图层 ID
975
+ */
976
+ remove(layerId: string): boolean;
977
+ /**
978
+ * 设置图层可见性
979
+ * @param layerId 图层 ID
980
+ * @param visible 是否可见
981
+ */
982
+ setVisible(layerId: string, visible: boolean): boolean;
983
+ /**
984
+ * 设置图层透明度
985
+ * @param layerId 图层 ID
986
+ * @param opacity 透明度 0-1
987
+ */
988
+ setOpacity(layerId: string, opacity: number): boolean;
989
+ /**
990
+ * 调整图层顺序
991
+ * @param layerId 图层 ID
992
+ * @param zIndex 新的层级
993
+ */
994
+ reorder(layerId: string, zIndex: number): boolean;
995
+ /**
996
+ * 将图层移到最上层
997
+ * @param layerId 图层 ID
998
+ */
999
+ bringToTop(layerId: string): boolean;
1000
+ /**
1001
+ * 将图层移到最下层
1002
+ * @param layerId 图层 ID
1003
+ */
1004
+ sendToBottom(layerId: string): boolean;
1005
+ /**
1006
+ * 获取图层配置
1007
+ * @param layerId 图层 ID
1008
+ */
1009
+ get(layerId: string): ImageryLayerConfig | undefined;
1010
+ /**
1011
+ * 获取底层 Cesium ImageryLayer
1012
+ * @param layerId 图层 ID
1013
+ */
1014
+ getLayer(layerId: string): Cesium.ImageryLayer | undefined;
1015
+ /**
1016
+ * 获取所有图层配置
1017
+ */
1018
+ list(): ImageryLayerConfig[];
1019
+ /**
1020
+ * 获取所有底图图层
1021
+ */
1022
+ listBaseLayers(): ImageryLayerConfig[];
1023
+ /**
1024
+ * 获取所有叠加图层
1025
+ */
1026
+ listOverlays(): ImageryLayerConfig[];
1027
+ /**
1028
+ * 检查图层是否存在
1029
+ * @param layerId 图层 ID
1030
+ */
1031
+ has(layerId: string): boolean;
1032
+ /**
1033
+ * 清除所有叠加层(保留底图)
1034
+ */
1035
+ clearOverlays(): void;
1036
+ /**
1037
+ * 清除所有图层
1038
+ */
1039
+ clear(): void;
1040
+ /**
1041
+ * 销毁管理器
1042
+ */
1043
+ destroy(): void;
1044
+ /**
1045
+ * 创建影像提供者
1046
+ */
1047
+ private createImageryProvider;
1048
+ /**
1049
+ * 自动检测天地图 WMTS 服务并补充配置
1050
+ */
1051
+ private autoDetectTiandituWmts;
1052
+ /**
1053
+ * 应用图层顺序
1054
+ */
1055
+ private applyZIndex;
1056
+ /**
1057
+ * 飞行到指定范围
1058
+ */
1059
+ private flyToBounds;
1060
+ }
1061
+
1062
+ /**
1063
+ * 3D Tiles 管理器类型定义
1064
+ */
1065
+ /** 3D Tiles 类型 */
1066
+ type TilesetType = '3dtiles' | 'pointcloud' | 'model';
1067
+ /** 3D Tiles 配置 */
1068
+ interface TilesetConfig {
1069
+ /** 唯一标识 */
1070
+ id: string;
1071
+ /** tileset.json URL */
1072
+ url: string;
1073
+ /** 类型,默认 '3dtiles' */
1074
+ type?: TilesetType;
1075
+ /** 是否显示,默认 true */
1076
+ show?: boolean;
1077
+ /** 最大屏幕空间误差,默认 16 */
1078
+ maximumScreenSpaceError?: number;
1079
+ /** 点云着色配置 */
1080
+ pointCloudShading?: {
1081
+ attenuation?: boolean;
1082
+ geometricErrorScale?: number;
1083
+ eyeDomeLighting?: boolean;
1084
+ eyeDomeLightingStrength?: number;
1085
+ eyeDomeLightingRadius?: number;
1086
+ };
1087
+ /** 自定义元数据 */
1088
+ metadata?: Record<string, unknown>;
1089
+ }
1090
+ /** 3D Tiles 加载选项 */
1091
+ interface TilesetLoadOptions {
1092
+ /** 加载后是否飞行到目标 */
1093
+ flyTo?: boolean;
1094
+ /** 飞行时长(秒) */
1095
+ flyDuration?: number;
1096
+ }
1097
+ /** 3D Tiles 加载结果 */
1098
+ interface TilesetLoadResult {
1099
+ /** Tileset ID */
1100
+ id: string;
1101
+ /** 是否成功 */
1102
+ success: boolean;
1103
+ /** 错误信息 */
1104
+ error?: string;
1105
+ }
1106
+ /** 3D Tiles 管理器事件 */
1107
+ interface TilesetManagerEvents {
1108
+ /** Tileset 已添加 */
1109
+ added: {
1110
+ config: TilesetConfig;
1111
+ };
1112
+ /** Tileset 已移除 */
1113
+ removed: {
1114
+ id: string;
1115
+ };
1116
+ /** 可见性变更 */
1117
+ visibilityChanged: {
1118
+ id: string;
1119
+ visible: boolean;
1120
+ };
1121
+ /** 发生错误 */
1122
+ error: {
1123
+ id?: string;
1124
+ error: unknown;
1125
+ };
1126
+ }
1127
+
1128
+ /**
1129
+ * 3D Tiles 管理器
1130
+ * 统一管理 3D Tiles、点云等数据的加载和生命周期
1131
+ */
1132
+
1133
+ declare class TilesetManager {
1134
+ private CesiumNS;
1135
+ private viewer;
1136
+ /** 已加载的 Tileset */
1137
+ private tilesets;
1138
+ /** 事件发射器 */
1139
+ events: Emitter<TilesetManagerEvents>;
1140
+ constructor(CesiumNS: typeof Cesium, viewer: Cesium.Viewer);
1141
+ /**
1142
+ * 添加 3D Tiles
1143
+ * @param config Tileset 配置
1144
+ * @param options 加载选项
1145
+ */
1146
+ add(config: TilesetConfig, options?: TilesetLoadOptions): Promise<TilesetLoadResult>;
1147
+ /**
1148
+ * 移除 Tileset
1149
+ * @param tilesetId Tileset ID
1150
+ */
1151
+ remove(tilesetId: string): boolean;
1152
+ /**
1153
+ * 设置 Tileset 可见性
1154
+ * @param tilesetId Tileset ID
1155
+ * @param visible 是否可见
1156
+ */
1157
+ setVisible(tilesetId: string, visible: boolean): boolean;
1158
+ /**
1159
+ * 获取 Tileset 配置
1160
+ * @param tilesetId Tileset ID
1161
+ */
1162
+ get(tilesetId: string): TilesetConfig | undefined;
1163
+ /**
1164
+ * 获取底层 Cesium Tileset
1165
+ * @param tilesetId Tileset ID
1166
+ */
1167
+ getTileset(tilesetId: string): Cesium.Cesium3DTileset | undefined;
1168
+ /**
1169
+ * 获取所有 Tileset 配置
1170
+ */
1171
+ list(): TilesetConfig[];
1172
+ /**
1173
+ * 检查 Tileset 是否存在
1174
+ * @param tilesetId Tileset ID
1175
+ */
1176
+ has(tilesetId: string): boolean;
1177
+ /**
1178
+ * 飞行到指定 Tileset
1179
+ * @param tilesetId Tileset ID
1180
+ * @param duration 飞行时长
1181
+ */
1182
+ flyTo(tilesetId: string, duration?: number): Promise<boolean>;
1183
+ /**
1184
+ * 清除所有 Tileset
1185
+ */
1186
+ clear(): void;
1187
+ /**
1188
+ * 销毁管理器
1189
+ */
1190
+ destroy(): void;
1191
+ /**
1192
+ * 创建 Tileset
1193
+ */
1194
+ private createTileset;
1195
+ /**
1196
+ * 飞行到 Tileset
1197
+ */
1198
+ private flyToTileset;
1199
+ }
1200
+
701
1201
  interface SceneOptions {
702
1202
  container: string | HTMLElement;
703
1203
  imagery?: ImageryOptions;
@@ -715,10 +1215,13 @@ declare class SceneManager {
715
1215
  private viewer;
716
1216
  private layerManager;
717
1217
  private cameraManager;
1218
+ private terrainManager;
1219
+ private imageryManager;
1220
+ private tilesetManager;
718
1221
  constructor(CesiumNS: typeof Cesium, options: SceneOptions);
719
1222
  getViewer(): Cesium.Viewer;
720
1223
  /**
721
- * Set a black background for areas without imagery. Optionally clear existing base imagery layers.
1224
+ * Set a black background for areas without imagery.
722
1225
  */
723
1226
  useBlackBackground(removeAllImagery?: boolean): void;
724
1227
  destroy(): void;
@@ -727,8 +1230,20 @@ declare class SceneManager {
727
1230
  setInitialCamera(view: CameraView | CameraInitOptions): void;
728
1231
  getCameraManager(): CameraManager;
729
1232
  getLayerManager(): LayerManager;
1233
+ getTerrainManager(): TerrainManager;
1234
+ getImageryManager(): ImageryManager;
1235
+ getTilesetManager(): TilesetManager;
1236
+ /**
1237
+ * @deprecated 请使用 getImageryManager().add() 代替
1238
+ */
730
1239
  setBaseImagery(url: string, layer_id: string, opts?: Omit<ImageryOptions, 'url'>): Cesium.ImageryLayer | undefined;
1240
+ /**
1241
+ * @deprecated 请使用 getTilesetManager().add() 代替
1242
+ */
731
1243
  set3DTiles(url: string, layer_id: string): Promise<any | undefined>;
1244
+ /**
1245
+ * @deprecated 请使用 getTerrainManager().switchTo() 代替
1246
+ */
732
1247
  setTerrain(options: TerrainOptions): Promise<Cesium.TerrainProvider | undefined>;
733
1248
  addDSM(options: {
734
1249
  url: string;
@@ -3398,6 +3913,8 @@ interface MassPolygonInteractionOptions {
3398
3913
  enableHover?: boolean;
3399
3914
  /** 是否启用点击选择(默认 false) */
3400
3915
  enableClick?: boolean;
3916
+ /** 是否启用右键菜单(默认 false) */
3917
+ enableRightClick?: boolean;
3401
3918
  /** 悬停高亮样式 */
3402
3919
  highlightStyle?: HighlightStyleOptions;
3403
3920
  /** 选中样式(点击后) */
@@ -3410,6 +3927,34 @@ interface MassPolygonInteractionOptions {
3410
3927
  onHover?: (id: string | null, data: PolygonData | null) => void;
3411
3928
  /** 点击回调 */
3412
3929
  onClick?: (id: string | null, data: PolygonData | null) => void;
3930
+ /** 右键回调 */
3931
+ onRightClick?: (id: string, data: PolygonData, screenPosition: {
3932
+ x: number;
3933
+ y: number;
3934
+ }) => void;
3935
+ }
3936
+ /**
3937
+ * 静态标签样式配置
3938
+ */
3939
+ interface StaticLabelStyleOptions {
3940
+ /** 字体(默认 '12px sans-serif') */
3941
+ font?: string;
3942
+ /** 文字颜色(CSS 颜色格式,默认 '#000000' 黑色) */
3943
+ fillColor?: string;
3944
+ /** 轮廓颜色(CSS 颜色格式,默认 '#ffffff' 白色) */
3945
+ outlineColor?: string;
3946
+ /** 轮廓宽度(默认 2) */
3947
+ outlineWidth?: number;
3948
+ /** 是否显示背景(默认 false) */
3949
+ showBackground?: boolean;
3950
+ /** 背景颜色(CSS 颜色格式,默认 'rgba(0,0,0,0.5)') */
3951
+ backgroundColor?: string;
3952
+ /** 背景内边距(默认 [4, 2]) */
3953
+ backgroundPadding?: [number, number];
3954
+ /** 像素偏移(默认 [0, 0]) */
3955
+ pixelOffset?: [number, number];
3956
+ /** 缩放比例(默认 1.0) */
3957
+ scale?: number;
3413
3958
  }
3414
3959
  /**
3415
3960
  * 批量创建选项
@@ -3427,6 +3972,8 @@ interface MassPolygonOptions {
3427
3972
  asynchronous?: boolean;
3428
3973
  /** 交互配置 */
3429
3974
  interaction?: MassPolygonInteractionOptions;
3975
+ /** 静态标签样式配置 */
3976
+ staticLabelStyle?: StaticLabelStyleOptions;
3430
3977
  }
3431
3978
  /**
3432
3979
  * 创建结果
@@ -3466,15 +4013,24 @@ declare class MassPolygonManager {
3466
4013
  private interactionOptions;
3467
4014
  private hoverHandler?;
3468
4015
  private clickHandler?;
4016
+ private rightClickHandler?;
3469
4017
  private highlightedId?;
3470
4018
  private originalHighlightFillColor?;
3471
4019
  private originalHighlightOutlineColor?;
3472
4020
  private selectedId?;
3473
4021
  private originalSelectFillColor?;
3474
4022
  private originalSelectOutlineColor?;
4023
+ private highlightPrimitive?;
4024
+ private selectPrimitive?;
4025
+ private groundOutlinePrimitive?;
3475
4026
  private lastPickTime;
3476
4027
  private readonly pickThrottleMs;
3477
4028
  private hoverLabel?;
4029
+ private staticLabelCollection?;
4030
+ private staticLabelsVisible;
4031
+ private staticLabelStyle;
4032
+ private terrainHeightCache;
4033
+ private isDestroyed;
3478
4034
  constructor(CesiumNS: typeof Cesium, viewer: Cesium.Viewer);
3479
4035
  /**
3480
4036
  * 获取图层名称
@@ -3497,6 +4053,19 @@ declare class MassPolygonManager {
3497
4053
  * 设置点击事件处理器
3498
4054
  */
3499
4055
  private setupClickHandler;
4056
+ /**
4057
+ * 设置右键事件处理器
4058
+ */
4059
+ private setupRightClickHandler;
4060
+ /**
4061
+ * 通过屏幕坐标获取地理位置,然后判断在哪个多边形内
4062
+ * 用于贴地模式下的精确拾取
4063
+ */
4064
+ private pickPolygonByPosition;
4065
+ /**
4066
+ * 判断点是否在多边形内(射线法)
4067
+ */
4068
+ private isPointInPolygon;
3500
4069
  /**
3501
4070
  * 处理鼠标离开
3502
4071
  */
@@ -3505,6 +4074,10 @@ declare class MassPolygonManager {
3505
4074
  * 高亮指定多边形(悬停)
3506
4075
  */
3507
4076
  private highlightPolygon;
4077
+ /**
4078
+ * 贴地模式下使用独立 Primitive 高亮/选中多边形
4079
+ */
4080
+ private highlightPolygonWithSeparatePrimitive;
3508
4081
  /**
3509
4082
  * 清除悬停高亮
3510
4083
  */
@@ -3528,11 +4101,17 @@ declare class MassPolygonManager {
3528
4101
  */
3529
4102
  getSelectedId(): string | null;
3530
4103
  /**
3531
- * 计算多边形中心点
4104
+ * 计算多边形中心点(简单平均)
3532
4105
  */
3533
4106
  private calculatePolygonCenter;
4107
+ /**
4108
+ * 计算多边形质心(更准确的中心点算法)
4109
+ * 使用多边形质心公式,对于凹多边形也能得到正确的中心位置
4110
+ */
4111
+ private calculatePolygonCentroid;
3534
4112
  /**
3535
4113
  * 显示悬停标签
4114
+ * 使用缓存的地形高度(如果可用)来正确放置标签
3536
4115
  */
3537
4116
  private showLabel;
3538
4117
  /**
@@ -3557,17 +4136,81 @@ declare class MassPolygonManager {
3557
4136
  getBounds(): GeoBounds | null;
3558
4137
  /**
3559
4138
  * 飞行到所有多边形的范围
4139
+ *
4140
+ * 优化说明:
4141
+ * 1. 多点采样地形高度(四角 + 中心),取最大值确保相机不会陷入地下
4142
+ * 2. 修正 pitch 角度对视角高度的影响计算
4143
+ * 3. 添加最小/最大高度限制,防止极端情况
4144
+ * 4. 使用异步地形查询获取更精确的高度
4145
+ * 5. 添加销毁检查,防止异步回调在实例销毁后执行
3560
4146
  */
3561
4147
  flyToBounds(options?: {
3562
4148
  duration?: number;
3563
4149
  padding?: number;
3564
4150
  pitch?: number;
3565
4151
  heading?: number;
4152
+ minHeight?: number;
4153
+ maxHeight?: number;
3566
4154
  }): void;
4155
+ /**
4156
+ * 同步版本的飞行方法(降级方案)
4157
+ */
4158
+ private flyToBoundsSync;
3567
4159
  /**
3568
4160
  * 设置可见性
3569
4161
  */
3570
4162
  setVisibility(visible: boolean): void;
4163
+ /**
4164
+ * 获取图层可见性
4165
+ */
4166
+ getVisibility(): boolean;
4167
+ /**
4168
+ * 隐藏整个图层
4169
+ */
4170
+ hide(): void;
4171
+ /**
4172
+ * 显示整个图层
4173
+ */
4174
+ show(): void;
4175
+ /**
4176
+ * 切换图层可见性
4177
+ * @returns 切换后的可见性状态
4178
+ */
4179
+ toggleVisibility(): boolean;
4180
+ /**
4181
+ * 显示所有多边形的静态标签(异步版本)
4182
+ * 在每个多边形的中心点显示其名称
4183
+ *
4184
+ * 注意:
4185
+ * 1. LabelCollection 不支持 heightReference 属性
4186
+ * 2. 贴地模式下,使用异步方法查询地形高度来正确放置标签
4187
+ * 3. 通过 disableDepthTestDistance 确保标签始终可见
4188
+ * 4. 查询的地形高度会被缓存,供 hover 标签使用
4189
+ */
4190
+ showStaticLabels(): Promise<void>;
4191
+ /**
4192
+ * 预加载所有多边形质心的地形高度(用于 hover 标签)
4193
+ * 在贴地模式下,建议在 create() 后调用此方法
4194
+ */
4195
+ preloadTerrainHeights(): Promise<void>;
4196
+ /**
4197
+ * 隐藏所有多边形的静态标签
4198
+ */
4199
+ hideStaticLabels(): void;
4200
+ /**
4201
+ * 切换静态标签显示状态
4202
+ * @returns 切换后的显示状态
4203
+ */
4204
+ toggleStaticLabels(): Promise<boolean>;
4205
+ /**
4206
+ * 获取静态标签显示状态
4207
+ */
4208
+ getStaticLabelsVisible(): boolean;
4209
+ /**
4210
+ * 设置静态标签样式
4211
+ * @param style 样式配置(部分)
4212
+ */
4213
+ setStaticLabelStyle(style: Partial<StaticLabelStyleOptions>): Promise<void>;
3571
4214
  /**
3572
4215
  * 更新样式(需要重新创建所有多边形)
3573
4216
  */
@@ -3749,4 +4392,4 @@ declare const placeholder: {
3749
4392
  };
3750
4393
  declare const droneModelUrl: string;
3751
4394
 
3752
- export { AirplaneCursor, type AirplaneCursorOptions, 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 CursorType, 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 HighlightStyleOptions, type HoverLabelStyleOptions, type ImageryOptions, type ImageryProviderKind, type InitOptions, type LODConfig, LODManager, type LODTarget, type LayerEvents, type LayerHandle, LayerManager, type LayerType, type Listener, type LoadMapLayersResult, type LoadSliceJsonOptions, type LoadSliceJsonResult, type LonLatHeight, type MapLayerConfig, type MassPolygonInteractionOptions, MassPolygonManager, type MassPolygonOptions, type MassPolygonResult, 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 PolygonData, type PolygonDrawingOptions, type PolygonEditingSession, PolygonEditor, type PolygonPoint, type PolygonStyleOptions, 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, type VertexDetailInfo, type VertexDragMoveInfo, type VertexOperationInfo, type WaypointBatchUpdate, type WaypointUpdateData, assertCesiumAssetsConfigured, bringDataSourceToTop, bringPrimitiveCollectionToTop, calculateAbsoluteHeight, calculateBoundsDiagonal, calculateDistance, calculateDistanceAndMidpoint, calculateGeoBounds, calculateHeadingBetweenPoints, calculateMidpoint, calculateRelativeHeight, configureCesiumAssets, configureCesiumIonToken, convertPathToSinofly, convertSinoflyWayline, convertSinoflyWaylines, droneModelUrl, ensureCesiumIonToken, ensureLayerAbove, expandBounds, getCesiumBaseUrl, getCesiumIonToken, getDataSourceIndex, getDataSourceOrder, globalCameraEventBus, globalState, isPointInBounds, mergeBounds, placeholder, queryTerrainHeightAsync, queryTerrainHeightByLonLat, queryTerrainHeightByLonLatSync, queryTerrainHeightSync, queryTerrainHeights, queryTerrainHeightsByLonLat, renderFlightPath, renderFlightPathPreview, toggle2D3D, version, versionInfo };
4395
+ export { AirplaneCursor, type AirplaneCursorOptions, 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 CursorType, 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 HighlightStyleOptions, type HoverLabelStyleOptions, type ImageryLayerConfig, type ImageryLayerType, type ImageryLoadOptions, type ImageryLoadResult, ImageryManager, type ImageryManagerEvents, type ImageryOptions, type ImageryProviderKind, type ImageryProviderType, type InitOptions, type LODConfig, LODManager, type LODTarget, type LayerEvents, type LayerHandle, LayerManager, type LayerType, type Listener, type LoadMapLayersResult, type LoadSliceJsonOptions, type LoadSliceJsonResult, type LonLatHeight, type MapLayerConfig, type MassPolygonInteractionOptions, MassPolygonManager, type MassPolygonOptions, type MassPolygonResult, 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 PolygonData, type PolygonDrawingOptions, type PolygonEditingSession, PolygonEditor, type PolygonPoint, type PolygonStyleOptions, 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 StaticLabelStyleOptions, type TerrainKind, TerrainManager, type TerrainManagerEvents, type TerrainOptions, type TerrainProviderType, type TerrainSourceConfig, type TerrainSourceType, type TerrainSwitchOptions, type TerrainSwitchResult, type TilesetConfig, type TilesetLoadOptions, type TilesetLoadResult, TilesetManager, type TilesetManagerEvents, type TilesetType, type Toggle2D3DContext, type Toggle2D3DOptions, type TrackStyleOptions, type VersionInfo, type VertexDetailInfo, type VertexDragMoveInfo, type VertexOperationInfo, type WaypointBatchUpdate, type WaypointUpdateData, assertCesiumAssetsConfigured, bringDataSourceToTop, bringPrimitiveCollectionToTop, calculateAbsoluteHeight, calculateBoundsDiagonal, calculateDistance, calculateDistanceAndMidpoint, calculateGeoBounds, calculateHeadingBetweenPoints, calculateMidpoint, calculateRelativeHeight, configureCesiumAssets, configureCesiumIonToken, convertPathToSinofly, convertSinoflyWayline, convertSinoflyWaylines, droneModelUrl, ensureCesiumIonToken, ensureLayerAbove, expandBounds, getCesiumBaseUrl, getCesiumIonToken, getDataSourceIndex, getDataSourceOrder, globalCameraEventBus, globalState, isPointInBounds, mergeBounds, placeholder, queryTerrainHeightAsync, queryTerrainHeightByLonLat, queryTerrainHeightByLonLatSync, queryTerrainHeightSync, queryTerrainHeights, queryTerrainHeightsByLonLat, renderFlightPath, renderFlightPathPreview, toggle2D3D, version, versionInfo };