import { MarkerEventKey, MarkerEventBus } from './MarkerEvent'; /** * 单个标签实例 */ interface LabelInstance { id: string; el: HTMLDivElement; theme: string; data?: any; notCreateElement?: boolean; unload?: any; } /** * 主题配置项 */ interface ThemeOptions { /** * 创建标签 DOM 内容的方法 */ createElement: (el: HTMLDivElement, context: { id: string; theme: string; data: any; }, options: ThemeOptions) => any; /** * 可选配置,如偏移量 */ options?: { offset?: { x?: number; y?: number; }; }; } /** * 标签添加时的参数 */ interface LabelOptions { id: string; lon: number; lat: number; height?: number; theme: string; show?: boolean; notCreateElement?: boolean; style?: { [key: string]: string; }; } export { LabelOptions, LabelInstance, ThemeOptions }; /** * 自定义事件与 DOM 事件的映射 */ export declare const DOM_EVENT_MAP: Record; interface OcclusionOptions { enabled: boolean; throttleMs: number; distanceEpsilon: number; } type OcclusionCheckReason = 'label-missing' | 'invalid-coordinate' | 'screen-position-undefined' | 'runtime-missing' | 'pick-unsupported' | 'pick-empty' | 'pick-error' | 'distance-compare'; interface OcclusionCheckLog { timestamp: number; id: string; lon?: number; lat?: number; height?: number; occluded: boolean; reason: OcclusionCheckReason; epsilon?: number; labelDistance?: number; pickedDistance?: number; } /** * 用于管理 Cesium HTML 标签的池,支持主题渲染、事件分发、动态更新等功能 */ export declare class HtmlOverlayLabelPool { private viewer; private Cesium; private container; private labels; private activeIds; private occludedIds; private _updateFn; private _cameraChangedFn; private themes; occlusionCheckLogs: OcclusionCheckLog[]; private occlusionLogEnabled; private occlusionLogMax; private occlusionOptions; private _occlusionTimer; private _lastOcclusionAt; private _occlusionChecking; private _occlusionPending; eventBus: MarkerEventBus; openWheel: boolean; /** * 构造函数 * @param Cesium Cesium 命名空间 * @param viewer Cesium Viewer 实例 * @param containerId HTML 容器 ID(默认:"html-label-container") * @param eventBus 可选:自定义事件总线 */ constructor(Cesium: any, viewer: any, containerId?: string, eventBus?: MarkerEventBus, openWheel?: boolean); /** * 创建标签容器 */ private _createContainer; /** * 注册标签主题 */ registerTheme(themeName: string, options: ThemeOptions): void; /** * 添加单个标签 */ add(data: any, options: LabelOptions): void; /** * 批量添加标签 */ addBatch(items: Array<{ data: any; options: LabelOptions; }>): void; /** * 根据 ID 批量移除标签 */ removeByIds(ids: string[]): void; unloadByLabel(label: LabelInstance): void; /** * 移除所有标签 */ removeAll(): void; /** * 更新标签的数据并刷新内容 */ update(id: string, newData: any): void; /** * 根据 ID 批量隐藏标签 */ hideByIds(ids: string[]): void; /** * 隐藏所有标签 */ hideAll(): void; /** * 条件过滤隐藏标签 */ hideFilter(filter: (data: any) => boolean): void; /** * 根据 ID 显示标签 */ showByIds(ids: string[]): void; /** * 检查标签是否存在 */ has(id: string): boolean; /** * 清空活跃 ID 列表(不影响 DOM) */ reset(): void; /** * 清理当前未活跃的标签(隐藏而不移除 DOM) */ cleanup(): void; /** * 经纬度 -> 自动地形高度修正 -> Cartesian3 -> 屏幕坐标 */ toWindowPositionByLonLat(lon: number, lat: number): Promise; /** * 坐标转换:经纬度 -> 屏幕像素坐标 */ toWindowCoordinates(position: any): any; /** * 检查经纬度是否有效 * @param lon 经度 * @param lat 纬度 * @returns 是否有效 */ private _isValidCoordinate; /** * 每帧刷新所有活跃标签的位置 */ private _update; private _scheduleOcclusionCheck; private _pushOcclusionLog; private _computeLabelOccluded; runOcclusionCheckNow(): void; setOcclusionEnabled(enabled: boolean): void; getOcclusionOptions(): OcclusionOptions; setOcclusionOptions(options: Partial>): void; setOcclusionLogEnabled(enabled: boolean, clearExisting?: boolean): void; /** * 销毁标签池,清理监听器和 DOM */ destroy(): void; }